cleanup
This commit is contained in:
@ -1,25 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.firefox.options import Options
|
||||
|
||||
|
||||
### Models
|
||||
|
||||
class Girls():
|
||||
class Models:
|
||||
def __init__(self):
|
||||
url_girls = "https://www.prosieben.de/tv/germanys-next-topmodel/models"
|
||||
|
||||
options = Options()
|
||||
options.headless = True
|
||||
driver = webdriver.Firefox(options=options)
|
||||
driver.get(url_girls)
|
||||
driver.execute_script("window.scrollTo(0, 1080);") # scroll to load page document.body.scrollHeight for page height
|
||||
html_girls = driver.page_source
|
||||
driver.close()
|
||||
|
||||
soup_girls = BeautifulSoup(html_girls, "html.parser")
|
||||
html_girls = requests.get(url_girls)
|
||||
soup_girls = BeautifulSoup(html_girls.text, "html.parser")
|
||||
|
||||
girls_in = soup_girls.findAll("a", class_="candidate-in")
|
||||
girls_out = soup_girls.findAll("a", class_="candidate-out")
|
||||
@ -28,7 +18,6 @@ class Girls():
|
||||
self.girls_out = {girl.find("h4", class_="candidate-title").text.lower(): girl for girl in girls_out}
|
||||
self.girls = {**self.girls_in, **self.girls_out}
|
||||
|
||||
|
||||
def get_in_names(self):
|
||||
return self.girls_in.keys()
|
||||
|
Reference in New Issue
Block a user