欢迎访问!

Office学习网

您现在的位置是:主页 > 网络技术

网络技术

某企查数据爬取python版

发布时间:2026-10-13网络技术次评论
前天看了别人的爬虫https://www.52pojie.cn/thread-1359373-1-1.htmlPHP的,不会用,无聊时改成python试试[mw_shl_code=python,true]#-* -

想要爬取的话加循环res3 = s.get(url= detail_url,headers =header)pattern = 'pid\:\(\d{14})'rel = re.findall(pattern,res2.text)detail_url='https://aiqicha.baidu.com/detail/basicAllDataAjax?pid='+rel[0] #只爬第一个。

headers = header)res3.text.encode('utf-8').decode('unicode_escape')result = json.loads(res3.text) #返回的企业信息JSON串 可以根据自己需要提取 , [Python] 纯文本查看 复制代码 # -*- coding: utf-8 -*-import requestsimport jsonimport urllibimport refrom faker import Fakerfake = Faker()header={'User-Agent': fake.user_agent()}name = input(请输入公司名称)data = urllib.parse.quote(str(name))url = 'https://aiqicha.baidu.com'url1='https://aiqicha.baidu.com/s?q='+data+'t=0's= requests.Session()res1 = s.get(url = url,。

headers =header)res2 = s.post(url = url1。

广告位

热心评论

评论列表