chris-greening / instascrape

Powerful and flexible Instagram scraping library for Python, providing easy-to-use and expressive tools for accessing data programmatically
https://chris-greening.github.io/instascrape/
MIT License
630 stars 107 forks source link

Making a data frame from all instagram posts of a user #99

Open daniqueosinga opened 3 years ago

daniqueosinga commented 3 years ago

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

amysimon97 commented 3 years ago

Just following up on this: Would really like to see if there's an update on this! Need this for a project!

JWLMSN commented 3 years ago

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]