import requests
from bs4 import BeautifulSoup
s = requests.Session()
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'}
s.get('https://mintrans.novreg.ru/perm/list.html', headers=headers, cookies={'abc': 'all', 'count': '10'})
links = []
for i in range(1, 4):
r = s.get(f'https://mintrans.novreg.ru/perm/list%7Bpage-{i}%7D.html', headers=headers, cookies={'abc': 'all', 'count': '10'})
soup = BeautifulSoup(r.text, 'html.parser')
data = soup.find('table')
links.append(data)
import requests
from bs4 import BeautifulSoup
url = 'https://www.avito.ru/pskov/tovary_dlya_kompyutera?q=i+7+7700'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36'}
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, 'html.parser')
items = soup.find_all('div', {'class': 'item_table-wrapper'})
parsed_items = []
for item in items:
parsed_items.append({'name': item.find('span', {'itemprop': 'name'}).get_text().strip(),
'price': item.find('meta', {'itemprop': 'price'})['content'],
'date': item.find('div', {'class': 'snippet-date-info'})['data-tooltip']
})
print(parsed_items)
new == item
. Выполнилась функция parse()
, записала новый контент в переменную item
, в то же время переменная new
осталось старой и равна пустой строке. В итоге item != new и цикл не выполнился и ваш рефраш никогда не выполнялся https://my.avon.ru/api/specialoffersapi/getcategorypromotions?promoCategoryId=19