0

i an having a problem! Im trying to find the source of a video using beautiful soup!

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)

However it returns this:

<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>

Now the source for the video is in there but i don't know how i can get it to another variable to use later in my program!

Remi Guan
  • 21,506
  • 17
  • 64
  • 87
Jonese1234
  • 193
  • 8

1 Answers1

3

Just replace

print(link_source)

with

print(link_source.get('src'))

For more details, please check the document(the tag.get() part).

Remi Guan
  • 21,506
  • 17
  • 64
  • 87