Abhishek Rai
Abhishek Rai

Reputation: 2227

Cannot find href on a page

I am trying to find the url for the trailer video from this page. https://www.binged.com/streaming-premiere-dates/black-monday/.

I checked the various properties of the div class="wordkeeper-video", I cannot find it. Can someone help?

enter image description here

Upvotes: 0

Views: 371

Answers (3)

JeffC
JeffC

Reputation: 25611

The full URL isn't there but all you need to build it is.

<div class="wordkeeper-video " data-type="youtube" data-embed="pzxGR6Q-7Mc" ...>

The data-embed attribute has what you need.

The URL is

https://www.youtube.com/watch?v=pzxGR6Q-7Mc
                                ^ here's the data-embed value

You can get this by using

data_embed = driver.find_element_by_css_selector(".wordkeeper-video").get_attribute("data-embed")
video_url = "https://www.youtube.com/watch?v=" + data_embed

Upvotes: 1

Prophet
Prophet

Reputation: 33361

The video href is not initially present there. You need first to click on the play button (actually the image), after that the href is presented inside the iframe there.
The iframe is .wordkeeper-video iframe So you have to switch to the iframe and then extract it's src attribute

Upvotes: 1

Ethan Rodrigo
Ethan Rodrigo

Reputation: 355

Go ahead and play it. Then there will be something like this. The link is in src tag

<iframe frameborder="0" allowfullscreen="" allow="autoplay" src="https://www.youtube.com/embed/pzxGR6Q-7Mc?rel=0&amp;showinfo=0&amp;autoplay=1"></iframe>

PS: It is in div class="wordkeeper-video"

Upvotes: 1

Related Questions