jackpot/testcase/new_api_body.py

15 lines
676 B
Python

import requests
import re
url_51 = 'https://search.51job.com/list/000000,000000,0000,00,9,99,%25E8%2587%25AA%25E5%258A%25A8%25E5%258C%2596%25E6%25B5%258B%25E8%25AF%2595%25E5%25B7%25A5%25E7%25A8%258B%25E5%25B8%2588,2,1.html?lang=c&postchannel=0000&workyear=99&cotype=99&degreefrom=99&jobterm=99&companysize=99&ord_field=0&dibiaoid=0&line=&welfare='
r_51 = requests.get(url=url_51)
r_51.encoding = 'gb2312'
print(r_51.text)
url_yun = re.findall('"company_href":"(.+?)","company_name":"艾德克斯电子(南京)有限公司"',r_51.text) #body中 text,html提取方式
print(url_yun)
r_51_yun=requests.get(url=url_yun[0])
r_51_yun.encoding ='gb2312'
print(r_51_yun.text)