instascrape icon indicating copy to clipboard operation
instascrape copied to clipboard

Making a data frame from all instagram posts of a user

Open daniqueosinga opened this issue 4 years ago • 2 comments

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

daniqueosinga avatar Feb 25 '21 13:02 daniqueosinga

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

amysimon97 avatar Jun 15 '21 11:06 amysimon97

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]

JWLMSN avatar Aug 20 '21 14:08 JWLMSN