-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_top10.py
32 lines (24 loc) · 914 Bytes
/
get_top10.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from get_url import *
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium import webdriver
import asyncio
def get_top10():
# Software which navigates with Chrome
chrome_driver = ChromeDriverManager().install()
op = webdriver.ChromeOptions()
op.add_argument('headless')
# What we are going to use to give orders to Chrome
driver = webdriver.Chrome(options=op, service=Service(chrome_driver))
# Open browser at URL
url = asyncio.run((get_url())) + 'browse/top10/'
driver.get(url)
top10 = []
show_covers = driver.find_elements(By.CLASS_NAME, "box-16x9")
for cover_img in show_covers:
show = cover_img.find_element(By.TAG_NAME, "img").get_attribute("alt")
top10.append(show)
# Close browser
driver.quit()
return top10