Skip to content
Advertisement

Can’t get href from Selenium webdriver scraping youtube

I am trying to scrape youtube videos from a channel by doing the following code below however, it seems that my element_titles don’t have a href attribute. This worked about a year ago and I am unsure why it doesn’t work now? Did youtube change the way we can get href?

JavaScript

The following attribtues are what is found in the WebDriver objects

JavaScript

I have tried exploring the web pages on youtube videos for the href however I am unable to find them

Advertisement

Answer

The below full working code will pull the required data here all the video links smoothly.

Example:

JavaScript

Output:

JavaScript

… so on

Advertisement