如何从Selenium获取推文ID

时间:2016-09-06 19:02:00

标签: python selenium twitter beautifulsoup

我看到了这段代码Parse the html code for a whole webpage scrolled down,但我不想只是文字,我也想要id。我该怎么做?

1 个答案:

答案 0 :(得分:1)

如果您想使用您提供的答案中的代码,您可以获得如下的推文ID:

soup = BeautifulSoup(page_source, 'html.parser')
for tweet in soup.select("div.tweet"):
    print tweet['data-tweet-id']
相关问题