发布网友 发布时间:2022-04-22 02:07
共2个回答
热心网友 时间:2023-09-25 17:40
百度搜索不用API接口,它是get请求,自己拼接就行了。
打开百度搜索,随便搜索一个关键字,看地址栏就有get请求的参数。
热心网友 时间:2023-09-25 17:40
百度api有很多接口,你是想调用什么接口呢?
# coding=utf-8
import requests
keyword = 'python'
url_search = "
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win; x) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/.0.3282.140 Safari/537.36 Edge/18.17763'
,
'Cookie': 'H_PS_PSSID=30974_1427_31326_21092_31253_31423_31342_31270_1996_31228_30824_311_31196; delPer=0; PSINO=6; BDRCVFR[SL8xzxBXZJn]=mk3SLVN4HKm; BAIDUID=92F2A6CAED4A8E797EF329C1BEA36AF0:FG=1; BIDUPSID=92F2A6CAED4A8E797EF329C1BEA36AF0; PSTM=1517023043; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; BD_HOME=1; BD_CK_SAM=1; H_PS_5EC=1d914DqBInyPzMSJ0BhiFxyUg23bH6JpxiRsTot0M6bB2pmhpTweczGUbAU; COOKIE_SESSION=1749_0_2_5_0_2_0_0_2_2_0_0_0_0_0_0_0_0_1587960538%7C5%230_0_1587960538%7C1; BD_UPN=1d314753'
}
res = requests.get(url_search,headers=headers)
print(res.content.decode())