Яндекс.Карты
- 1 ответ
- 0 вопросов
0
Вклад в тег
from bs4 import BeautifulSoup
import requests
import json
from urllib.parse import urlparse
url = "https://yandex.ru/maps/api/business/fetchReviews?ajax=1&businessId=221702091001&csrfToken=97fd195e6cf78eb6f395d7c395d296ab5c11d1f1:1571717475&page=1&pageSize=5&ranking=by_time&reqId=1571655534207434-3187132131-sas1-1604&sessionId=1571655349968_626529"
url_post = "https://yandex.ru/maps/api/business/fetchReviews"
s = requests.session()
p = s.post(url_post)
data = json.loads(p.content)
parsed = urlparse(url)
querys = parsed.query.split("&")
querys[2]='csrfToken'+"="+data['csrfToken']
querys = '&'.join(querys)
url=url_post+"?"+querys
r = s.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
print(soup)