Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- def get_page(category: str, page_id: int) -> str:
- if page_id:
- url = 'https://www.ozon.ru/brand/{0}/?page={1}'.format(category, page_id)
- else:
- url = 'https://www.ozon.ru/brand/{0}/'.format(category)
- print('get url: {0}'.format(url))
- response = requests.get(url)
- return response.text
- def load_data():
- category_list = ['adidas-144082850', 'puma-87235756']
- for category in category_list:
- for page_id in range(50):
- text = get_page(category, page_id)
- # обрабатываем полученный текст, сохраняем в файл/базу
- if __name__ == '__main__':
- load_data()
Add Comment
Please, Sign In to add comment