instascrape
instascrape copied to clipboard
Making a data frame from all instagram posts of a user
Hi there, I want to make a dataframe from all instagram posts of users (number of likes, tags, number of comments, etc.). I am using these lines of code but how do I make a dataframe from it? posts = kyliecosmetics.get_posts(webdriver=webdriver,login_first=True) scraped_posts, unscraped_posts = scrape_posts(posts, headers=headers, pause=10, silent=False)
It does seems to work with this code for the last 12 posts: recent_postskylie = kyliecosmetics.get_recent_posts() posts_datakylie = [post.to_dict() for post in recent_postskylie] posts_dfkylie = pd.DataFrame(posts_datakylie)
But I would like to use the code on all posts. Thank you in advance
Just following up on this: Would really like to see if there's an update on this! Need this for a project!
You need to unpack the list of scraped_posts that has been passed from scrape_posts(). So just use your code but instead of ... = [post.to_dict() for post in posts] do ... = [post.to_dict() for post in scraped_posts]