from selenium import webdriver
from selenium.webdriver.common.by import By
import requests
from selenium.webdriver.chrome.options import Options
import time
class Parser():
def __init__(self,url):
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument("--disable-blink-features=AutomationControlled")
self.driver = webdriver.Chrome(options=options)
self.url = url
def parse(self):
self.list_of_towns = ['moskva','sankt-peterburg','arhangelsk','vladivostok','volgograd','voronezh','ekaterinburg','izhevsk','irkutsk','kazan','kemerovo','krasnodar','krasnoyarsk','murmansk','naberezhnye-chelny',
'nizhniy-novgorod','novosibirsk','omsk','perm','rostov-na-donu','saratov','samara','sochi','surgut','tver','tolyatti','tula','tyumen','ulyanovsk','ufa','habarovsk','chelyabinsk','yaroslavl']
self.cityes = []
try:
self.driver.get(self.url+'/availability')
#self.button = self.driver.find_element(By.XPATH,'//a[@class="b-product-tabs-link _nowrap"]').click()
self.driver.implicitly_wait(8)
self.shops = self.driver.execute_script('return shopsObj')
for shop in self.shops:
print(shop['address'], shop['availability_hint'])
finally:
pass
p = Parser('https://www.svyaznoy.ru/catalog/accessories/8936/6270567/availability/moskva#mainContent')
p.parse()
self.shops
пустой?
https://github.com/Rapptz/discord.py/issues/6839
Эти функции повырезали. По идее, можно попробовать ниже 1.7 версию поставить