[Python] 纯文本查看 复制代码 import requests
import re
cookie = ''
def get_pid_tid():
url = 'https://www.qcc.com/web/search/advance-new?hasState=true'
headers = {
'accept-encoding': 'gzip, deflate, br'
,'accept-language': 'zh-CN,zh;q=0.9'
,'cache-control': 'max-age=0'
,'cookie': cookie
,'referer': 'https://www.qcc.com/'
,'sec-fetch-dest': 'document'
,'sec-fetch-mode': 'navigate'
,'sec-fetch-site': 'same-origin'
,'sec-fetch-user': '?1'
,'upgrade-insecure-requests': '1'
,'user-agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'''
}
res = requests.get(url, headers=headers).text
try:
pid = re.findall("pid='(.*?)'", res)[0]
tid = re.findall("tid='(.*?)'", res)[0]
except:
pid = ''
tid = ''
return pid, tid
企查查需要再后续获取数据的话,先要获取到pid和tid但是,使用cookie去获取一次就会导致网页端那账号被注销登录,cookie失效,要如何解决这个问题呢 |