tweet_scrapper icon indicating copy to clipboard operation
tweet_scrapper copied to clipboard

Scrape Profile Image URL

Open farisalasmary opened this issue 5 years ago • 1 comments

I've been using this library for a while but unfortunately I did not find profile image URL within the scraped data. I've struggled to modify the code but with no result! My real problem is with twitter's class name obfuscation. For example, class="css-1dbjc4n r-1j3t67a" is the CSS class used inside the div of each tweet but in your code it is as simple as https://github.com/5hirish/tweet_scrapper/blob/4337e09aae8d82cdd0f63d5ec9978e0aa0a1a571/tweetscrape/tweets_scrape.py#L32. How could you know the real name of the class? also, how can you add a new feature like profile image URL?

farisalasmary avatar Sep 24 '19 18:09 farisalasmary

@farisalasmary this library uses XPATH to scrape data. So to get the profile picture image one could use: //*[@id="page-container"]/div[1]/div/div[1]/div[2]/div[1]/div/a/img XPATH query. You can even further simplify this XPATH query. If you do add this please raise a PR and I will merge it.

5hirish avatar Sep 25 '19 07:09 5hirish