我患了一天的病。我想爬有网页的网站。
我发现当每个页面都有不同的URL时,我可以对其进行爬网
就像(第1页。第2页…等等)。。
但我正在努力抓取的网站,它从未改变过它的url,即使我进入下一页。
有什么办法可以刮去这种页面吗?谢谢大家!
这段代码是用python编写的结果
import requests
cookies = {
'WMONID': 'smDC5Ku5TeX',
'userId': 'robin9634',
'UID': 'robin9634',
'JSESSIONID': 'lLqLdHFEk4iEJdQ2HCR5m05tg6ZIxBdegEamDzxeEoTClkvqVDN4xzXeMPtTIN3e.cG9ydGFsX2RvbWFpbi9wZDU=',
}
headers = {
'Connection': 'keep-alive',
'Cache-Control': 'max-age=0',
'Upgrade-Insecure-Requests': '1',
'Origin': 'https://dhlottery.co.kr',
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-User': '?1',
'Sec-Fetch-Dest': 'document',
'Referer': 'https://dhlottery.co.kr/gameInfo.do?method=powerWinNoList',
'Accept-Language': 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7',
}
params = (
('method', 'powerWinNoList'),
)
data = {
'nowPage': '7',
'searchDate': '20200909',
'calendar': '2020-09-09',
'sortType': 'num'
}
response = requests.post('https://dhlottery.co.kr/gameInfo.do', headers=headers, params=params, cookies=cookies, data=data)
#NB. Original query string below. It seems impossible to parse and
#reproduce query strings 100% accurately so the one below is given
#in case the reproduced version is not "correct".
# response = requests.post('https://dhlottery.co.kr/gameInfo.do?method=powerWinNoList', headers=headers, cookies=cookies, data=data)
目前没有回答
相关问题 更多 >
编程相关推荐