dannyvassallo / insta_scrape

The instagram swiss army knife. Restores all deprecated hashtag functionality and grants public api access from instagram's front end without any of the authorization.
https://rubygems.org/gems/insta_scrape
MIT License
60 stars 27 forks source link

InstaScrape.long_scrape_hashtag only returns 4 posts #25

Closed krat0m2 closed 7 years ago

krat0m2 commented 7 years ago

Hello,

I'm trying to retrieve all of the usernames that are associated with a specific hashtag. Here is the code.

require "csv" require "insta_scrape"

def appendRowToCsv(row) CSV.open("instagram_posts.csv", "a+",) do |csv| csv << row end end

appendRowToCsv(['username']);

scrape_result = InstaScrape.long_scrape_hashtag('dripmoreicedteas', 0, include_meta_data: true) scrape_result.each do |post|

appendRowToCsv([post.username]) end

The code writes 4 usernames to the CSV file. I cannot figure out how to retrieve more than 4 usernames. Any assistance would be greatly appreciated.

Thank you!

oguzcanhuner commented 7 years ago

change the 0 to 1 in InstaScrape.long_scrape_hashtag('dripmoreicedteas', 0, include_meta_data: true). that number indicates how many seconds the scrape should go on for, so the higher it is, the more results you will get

dannyvassallo commented 7 years ago

@oguzcanhuner Thanks for helping out! I was on vacation and didn't see this!

krat0m2 commented 7 years ago

Dannyvassallo,

Adding a different number to the arguments of long_scrape_hashtag does not change how many results are posted to the console or csv. I am only receiving 7 usernames now. The instagram hashtag url looks like it adds a different code to the url for the hashtag - grouped in sections of 4 to 7.

Examples: https://www.instagram.com/p/BS5LEUfDYFb/?tagged=dripmoreicedteas https://www.instagram.com/p/BRDpJBchrU9/?tagged=dripmoreicedteas https://www.instagram.com/p/BQ4jUxLF1cx/?tagged=dripmoreicedteas


Dannyvassallo,

Do you know any way around this? I need to be able to scrape a hashtag and list all the usernames who have posted that tag. Using this feature to compile a list of usernames for a instagram giveaway.

Any help would be greatly appreciated!

Thank you!

dannyvassallo commented 7 years ago

@krat0m2 don't add more arguments. You have a 0 for the time to crawl. Raise the integer from a 0 to something higher ie: InstaScrape.long_scrape_hashtag('dripmoreicedteas', 20, include_meta_data: true) vs your InstaScrape.long_scrape_hashtag('dripmoreicedteas', 0, include_meta_data: true)