2015-11-03 20 views
0

我有一個問題! 我試圖找到使用美麗的湯視頻的來源!獲得第一個鏈接在湯找

link = 'http://oddshot.tv/shot/dreamhackcs-20151101122251803' 
r = requests.get(link) 
plain_text = r.text 
#print(r.text) 
soup = BeautifulSoup(plain_text, "html.parser") 
link_source = soup.find('source', src=True, href=False) 
print(link_source) 

但是它返回:

<source src="https://d301dinc95ec5f.cloudfront.net/capture/dreamhackcs-20151101122251803.shot.mp4" type="video/mp4"><p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p></source> 

現在的視頻源在那裏,但我不知道我怎樣才能得到它的另一個變量在我的程序後使用!

回答

3

只需更換

print(link_source) 

print(link_source.get('src')) 

有關詳細信息,請the document(在tag.get()部分)。

相關問題