Advertisement
Guest User

Instagram Business Profile Extractor (05.04.2018)

a guest
May 4th, 2018
2,769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 12.39 KB | None | 0 0
  1. # THIS IS SCRAPER CONFIG FOR SCRAPING SERVICE DIGGERNAUT
  2. ---
  3. config:
  4.     agent: Firefox
  5.     debug: 2
  6. do:
  7. - variable_set:
  8.     field: username
  9.     value: YOU_ACCOUNT_USERNAME_HERE
  10. - variable_set:
  11.     field: password
  12.     value: YOU_ACCOUNT_PASSWORD_HERE
  13. - variable_set:
  14.     field: accounts
  15.     value: LIST OF ACCOUNTS COMMA SEPARATED YOU WANT TO GET BUSINESS PROFILES FOR
  16. - walk:
  17.     to: https://www.instagram.com/
  18.     do:
  19.     - find:
  20.         path: body
  21.         do:
  22.         - parse:
  23.             filter: window\._sharedData\s+\=\s+([^;]+);
  24.         - normalize:
  25.             routine: json2xml
  26.         - to_block
  27.         - find:
  28.             path: config>csrf_token
  29.             do:
  30.            - parse
  31.             - variable_set: token
  32.         - walk:
  33.             to:
  34.                 post: https://www.instagram.com/accounts/login/ajax/
  35.                 headers:
  36.                     x-csrftoken: <%token%>
  37.                     x-instagram-ajax: 1
  38.                     x-requested-with: XMLHttpRequest
  39.                 data:
  40.                     username: <%username%>
  41.                     password: <%password%>
  42.             do:
  43.             - find:
  44.                 path: status
  45.                 do:
  46.                - parse
  47.                 - if:
  48.                     match: "fail"
  49.                     do:
  50.                    - cannot_login_probably_checkpoint_is_required
  51.                     - exit
  52.             - find:
  53.                 path: authenticated
  54.                 do:
  55.                - parse
  56.                 - if:
  57.                     match: "true"
  58.                     else:
  59.                    - wrong_login_or_password
  60.                     - exit
  61.                 - cookie_get: mid
  62.                 - variable_set: mid
  63.                 - cookie_get: rur
  64.                 - variable_set: rur
  65.                 - cookie_get: ds_user_id
  66.                 - variable_set: dsuserid
  67.                 - cookie_get: sessionid
  68.                 - variable_set: sessionid
  69.                 - variable_get: accounts
  70.                 - to_block
  71.                 - split:
  72.                     context: text
  73.                     delimiter: ','
  74.                 - find:
  75.                     path: div.splitted
  76.                     do:
  77.                    - parse
  78.                     - space_dedupe
  79.                     - trim
  80.                     - variable_set: account
  81.                     - walk:
  82.                         to: https://www.instagram.com/<%account%>/
  83.                         do:
  84.                         - find:
  85.                             path: script:contains("window._sharedData")
  86.                             do:
  87.                            - parse
  88.                             - space_dedupe
  89.                             - trim
  90.                             - filter:
  91.                                 args:
  92.                                    - window\._sharedData\s+\=\s+(.+)\s*;\s*$
  93.                             - normalize:
  94.                                 routine: json2xml
  95.                             - to_block
  96.                             - find:
  97.                                 path: body_safe
  98.                                 do:
  99.                             - find:
  100.                                 path: entry_data > profilepage > graphql > user > id
  101.                                 do:
  102.                                - parse
  103.                                 - variable_set: id
  104.                                 - walk:
  105.                                     to: https://i.instagram.com/api/v1/users/<%id%>/info/
  106.                                     headers:
  107.                                         X-IG-App-ID: 567067343352427
  108.                                         X-IG-Capabilities: 3brDAw==
  109.                                         X-IG-Connection-Type: WIFI
  110.                                         X-IG-Connection-Speed: 3400
  111.                                         X-IG-Bandwidth-Speed-KBPS: -1.000
  112.                                         X-IG-Bandwidth-TotalBytes-B: 0
  113.                                         X-IG-Bandwidth-TotalTime-MS: 0
  114.                                         Cookie: mid=<%mid%>; csrftoken=<%token%>; rur=<%rur%>; ds_user_id=<%dsuserid%>; sessionid=<%sessionid%>; ig_or=;
  115.                                         X-FB-HTTP-Engine: Liger
  116.                                         Accept: '*/*'
  117.                                         Accept-Language: en-US
  118.                                     do:
  119.                                     - find:
  120.                                         path: body_safe > user
  121.                                         do:
  122.                                         - object_new: item
  123.                                         - find:
  124.                                             path: address_street
  125.                                             do:
  126.                                            - parse
  127.                                             - space_dedupe
  128.                                             - trim
  129.                                             - object_field_set:
  130.                                                 object: item
  131.                                                 field: address_street
  132.                                         - find:
  133.                                             path: category
  134.                                             do:
  135.                                            - parse
  136.                                             - space_dedupe
  137.                                             - trim
  138.                                             - object_field_set:
  139.                                                 object: item
  140.                                                 field: category
  141.                                         - find:
  142.                                             path: city_name
  143.                                             do:
  144.                                            - parse
  145.                                             - space_dedupe
  146.                                             - trim
  147.                                             - object_field_set:
  148.                                                 object: item
  149.                                                 field: city_name
  150.                                         - find:
  151.                                             path: contact_phone_number
  152.                                             do:
  153.                                            - parse
  154.                                             - space_dedupe
  155.                                             - trim
  156.                                             - object_field_set:
  157.                                                 object: item
  158.                                                 field: contact_phone_number
  159.                                         - find:
  160.                                             path: external_url
  161.                                             do:
  162.                                            - parse
  163.                                             - space_dedupe
  164.                                             - trim
  165.                                             - object_field_set:
  166.                                                 object: item
  167.                                                 field: external_url
  168.                                         - find:
  169.                                             path: full_name
  170.                                             do:
  171.                                            - parse
  172.                                             - space_dedupe
  173.                                             - trim
  174.                                             - object_field_set:
  175.                                                 object: item
  176.                                                 field: full_name
  177.                                         - find:
  178.                                             path: is_business
  179.                                             do:
  180.                                            - parse
  181.                                             - space_dedupe
  182.                                             - trim
  183.                                             - object_field_set:
  184.                                                 object: item
  185.                                                 field: is_business
  186.                                         - find:
  187.                                             path: latitude
  188.                                             do:
  189.                                            - parse
  190.                                             - space_dedupe
  191.                                             - trim
  192.                                             - object_field_set:
  193.                                                 object: item
  194.                                                 field: latitude
  195.                                         - find:
  196.                                             path: longitude
  197.                                             do:
  198.                                            - parse
  199.                                             - space_dedupe
  200.                                             - trim
  201.                                             - object_field_set:
  202.                                                 object: item
  203.                                                 field: longitude
  204.                                         - find:
  205.                                             path: pk
  206.                                             do:
  207.                                            - parse
  208.                                             - space_dedupe
  209.                                             - trim
  210.                                             - object_field_set:
  211.                                                 object: item
  212.                                                 field: id
  213.                                         - find:
  214.                                             path: public_email
  215.                                             do:
  216.                                            - parse
  217.                                             - space_dedupe
  218.                                             - trim
  219.                                             - object_field_set:
  220.                                                 object: item
  221.                                                 field: public_email
  222.                                         - find:
  223.                                             path: public_phone_country_code
  224.                                             do:
  225.                                            - parse
  226.                                             - space_dedupe
  227.                                             - trim
  228.                                             - object_field_set:
  229.                                                 object: item
  230.                                                 field: public_phone_country_code
  231.                                         - find:
  232.                                             path: public_phone_number
  233.                                             do:
  234.                                            - parse
  235.                                             - space_dedupe
  236.                                             - trim
  237.                                             - object_field_set:
  238.                                                 object: item
  239.                                                 field: public_phone_number
  240.                                         - find:
  241.                                             path: username
  242.                                             do:
  243.                                            - parse
  244.                                             - space_dedupe
  245.                                             - trim
  246.                                             - object_field_set:
  247.                                                 object: item
  248.                                                 field: username
  249.                                         - find:
  250.                                             path: zip
  251.                                             do:
  252.                                            - parse
  253.                                             - space_dedupe
  254.                                             - trim
  255.                                             - object_field_set:
  256.                                                 object: item
  257.                                                 field: zip
  258.                                         - object_save:
  259.                                             name: item
  260.                     - sleep: 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement