didiaoshenghuo 发表于 2022-12-28 15:15

python爬取网址信息返回值不对

爬取网址的信息,抓到的内容和页面显示的内容不对,请大佬们帮忙指导一下:lol:lol:lol

import requests
from bs4 import BeautifulSoup
import csv
import json

# https://www.numbers.link/data-list/EOSYGSG313
url = "https://www.numbers.link/nl-dataplan-management-service/proxy-public/data-round/list"
headers = {    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36" }
data = {"page":1,"limit":10,"planId":2}data = json.dumps(data)
resp = requests.post(url=url,data=data,headers=headers)
dic =resp.json() # print(resp.text)

print("获取的访问地址:" + resp.url)# print("开奖期数" +dic['data']['items']['roundId'])# print("获取到的参数:" , resp.json()['data']['items'])
print(dic['data']['meta'])
for i in dic['data']['items'] :    print( i["roundId"],i["compositeResult"] )    # print(i)
print("======END=======")
页: [1]
查看完整版本: python爬取网址信息返回值不对