Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from selenium.webdriver.common.keys import Keys
- from selenium.common.exceptions import TimeoutException
- from selenium.common.exceptions import NoSuchElementException
- from selenium.webdriver.common.by import By
- import selenium.webdriver.support.ui as ui
- import selenium.webdriver.support.expected_conditions as EC
- import os
- import time
- import sys
- #import configparser
- #Nastavení Driveru
- options = webdriver.ChromeOptions()
- options.add_argument('--ignore-certificate-errors')
- options.add_argument('--ignore-sll-errors')
- options.add_argument('log-level=3') #Ignorovat výpis erorů
- options.add_argument("--disable-infobars") #DISABLE: Chrome is being controlled by automated test software
- options.add_argument('headless') #Bez Hlavičky
- dir_path = os.path.dirname(os.path.realpath(__file__))
- chromedriver = "/chromedriver"
- os.environ["webdriver.chrome.driver"] = chromedriver
- driver = webdriver.Chrome(chrome_options=options)
- os.system('cls')
- sys.tracebacklimit = 0
- i=10060
- while i < 110000:
- i += 1
- urlwhile = "https://www.sledujfilmy.online/web/film/{0}".format(i)
- driver.get(urlwhile)
- try:
- film_url = driver.find_element_by_xpath('//*[@id="iframe-box"]').get_attribute('src')
- except NoSuchElementException:
- continue
- film_obrazek = "https://www.sledujfilmy.online/images/posters/{0}.jpg".format(i)
- film_jmeno = driver.find_element_by_xpath('/html/body/div[6]/div/div[1]/h3').text
- film_zanr = driver.find_element_by_xpath('/html/body/div[6]/div/div[1]/p').text
- #print(film_url, film_obrazek, film_popis, film_jmeno, film_zanr)
- file = open("sledujufilmyonline.txt","a", encoding='utf-8')
- file.write('{')
- file.write('"name": "{0}",'.format(film_jmeno))
- file.write('"genre": "{0}",'.format(film_zanr))
- file.write('"thumb": "{0}",'.format(film_obrazek))
- file.write('"video": "{0}"'.format(film_url))
- file.write('},')
- file.write('\n')
- file.close()
- print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement