-3

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?

Community
  • 1
  • 1
Miss.Saturn
  • 155
  • 2
  • 13

1 Answers1

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