Created
October 27, 2016 03:39
-
-
Save dannyvassallo/e3b00cb7c1002fda891c3f9d8e864393 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "csv" | |
require "insta_scrape" | |
def appendRowToCsv(row) | |
CSV.open("instagram_posts.csv", "a+",) do |csv| | |
csv << row | |
end | |
end | |
# create headers | |
appendRowToCsv(['image', 'link']); | |
# iterate through posts appending each new photo to csv | |
scrape_result = InstaScrape.hashtag("test") #change the scrape method / tag to what you want | |
scrape_result.each do |post| | |
appendRowToCsv([post.image, post.link]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment