def _make_alternative_proxy(self):
proxy = {'http': f'http://user-{self.login}-country-{self.iso_code}:{self.pswd}@gate.smartproxy.com:7000/',
'https': f'http://user-{self.login}-country-{self.iso_code}:{self.pswd}@gate.smartproxy.com:7000/'}
return proxy
response = requests.post(endpoint, proxies = self.proxy)
from bs4 import BeautifulSoup as bs
import requests
url = "https://www.anekdot.ru/release/anekdot/year/"
headers = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36 OPR/85.0.4341.72 (Edition Yx GX)"}
r = requests.get(url, headers = headers)
soup = bs(r.text, 'lxml')
content = soup.find_all('div', class_ = 'topicbox')
topics = [item.get_text(strip = True) for item in content]
cards = []
for item in items:
cards.append({"title": item.find("div", class_="text").get_text()})