I saw this code Parse the html code for a whole webpage scrolled down but I don't want just the text, I want the id too. How do I do that?
Asked
Active
Viewed 538 times
1 Answers
1
If you want to use code from the answer you provided, you can get the tweet id like this:
soup = BeautifulSoup(page_source, 'html.parser')
for tweet in soup.select("div.tweet"):
print tweet['data-tweet-id']

jozo
- 4,232
- 1
- 27
- 29
-
Thanks, this worked just fine. (I had to put a try/except). – Miss.Saturn Sep 07 '16 at 00:49