【发布时间】:2016-10-25 15:38:50
【问题描述】:
我目前尝试提取嵌入 Twitter 视频中号召性用语按钮中的 URL。一个例子:
在使用 Chrome Inspect 时,我可以相对轻松地发现我在寻找什么:
现在我正在尝试在 Python 中抓取该突出显示的链接。 我找不到任何从 Twitter API 获取它的方法,因此我切换到 BeautifulSoup。但是当搜索任何链接时,它不会显示给我:
In[23]: url = "https://amp.twimg.com/v/a693e53f-a6a3-4ff1-b06e-7c5402db0e06"
In[24]: resp = requests.get(url).content
In[25]: soup = BeautifulSoup(resp, 'lxml')
In[26]: soup.find_all('a')
Out[26]:
[<a href="https://twitter.com/unibet" target="_blank">@unibet</a>,
<a class="download-btn" id="app-download"><img id="whiteLogo"
src="https://amp.twimg.com/amplify-web-player/prod/styles/img/twitter_logo_white.png"/></a>]
知道我可以做些什么来提取那个嵌入的 URL 吗?非常感谢任何帮助!
【问题讨论】:
标签: python html twitter web-scraping tweepy