Advertisement
Kreol2013

Untitled

Mar 19th, 2021
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. class Parser {
  2. constructor() {
  3. this.defaultConf = {
  4. version: "0.1.16",
  5. results: {
  6. flat: [
  7. ["name", "Name Geo loc"]
  8. ],
  9. arrays: {
  10. posts: ['Posts', [["link", "Link"]]]
  11. }
  12. },
  13. results_format: "$posts.format('$link\\n')",
  14. parsecodes: {
  15. 200: 1,
  16. },
  17. max_size: 200 * 1024,
  18. Social_Instagram_Geo_preset: 'default'
  19. };
  20.  
  21. this.editableConf = [[ "Social_Instagram_Geo_preset", ["combobox", "Social::Instagram::Geo"]],];
  22. }
  23.  
  24. *parse(set, results) {
  25. this.logger.put("Start scraping query: " + set.query);
  26.  
  27. let response = yield this.parser.request(
  28. "Social::Instagram::Geo",
  29. this.conf.Social_Instagram_Geo_preset,
  30. {
  31. resultArraysWithObjects: 1,
  32. pagecount: 1,
  33. },
  34. set.query
  35. );
  36. if (response.success) {
  37. results.name = response.name;
  38. // results.count = 0;
  39. for (let i = 1; i < response.posts.length; i++) {
  40. results.posts.push(response.posts[i]);
  41. }
  42.  
  43. this.logger.put("RESULTS " + response.name);
  44. }
  45.  
  46. results.success = response.success;
  47.  
  48. return results;
  49. }
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement