I want to extract all the URLs from this website. To be more precise I need a list of all the video URLs.
Asked
Active
Viewed 325 times
-5
-
What have you tried? Where are you stuck? Did you see [Extract all links from a web page using python](https://stackoverflow.com/q/34610162/3744182) or [How to extract URLs from an HTML page in Python](https://stackoverflow.com/q/15517483/3744182) or [Scrapy get all links from any website](https://stackoverflow.com/q/48946320/3744182)? – dbc Mar 31 '20 at 17:50
1 Answers
0
Since all the links have a class in common (class="blue"), you can select all the web elements using this code, and then get the "href" attribute values:
elements = driver.find_elements_by_class_name('blue');
urls = [elements.get_attribute('href') for elements in elements]
I recommend this site if you want to learn more about Selenium Python : Learn to Locate Elements using Selenium Python with Examples
HoldOffHunger
- 15,349
- 8
- 79
- 115
Xerox9000
- 79
- 1
- 10