文章目录
1 访问百度
1.1 百度检索
from bs4 import BeautifulSoup
import requests
def baidu_search(keyword):
# 设置请求头部信息,模拟浏览器访问
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36'