国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

網(wǎng)頁(yè)爬蟲(chóng) - python 爬蟲(chóng)怎么處理json內(nèi)容

瀏覽:117日期:2022-06-28 10:38:23

問(wèn)題描述

網(wǎng)頁(yè)爬蟲(chóng) - python 爬蟲(chóng)怎么處理json內(nèi)容

網(wǎng)頁(yè)爬蟲(chóng) - python 爬蟲(chóng)怎么處理json內(nèi)容

看不清的話 網(wǎng)站地址是http://www.sse.com.cn/disclos...紅字是我需要的內(nèi)容 但是我提取不出來(lái)求教怎么操作

問(wèn)題解答

回答1:

import requestsurl = ’http://query.sse.com.cn/commonSoaQuery.do?siteId=28&sqlId=BS_GGLL&extGGLX=&stockcode=&channelId=10743%2C10744%2C10012&extGGDL=&order=createTime%7Cdesc%2Cstockcode%7Casc&isPagination=true&pageHelp.pageSize=15&pageHelp.pageNo=1&pageHelp.beginPage=1&pageHelp.cacheSize=1&pageHelp.endPage=5’headers = { ’Referer’:’http://www.sse.com.cn/disclosure/credibility/supervision/inquiries/’, ’User-Agent’:’Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36’}r = requests.get(url, headers=headers)print r.json()[’result’]回答2:

import requestsurl = ’http://query.sse.com.cn/commonSoaQuery.do?siteId=28&sqlId=BS_GGLL&extGGLX=&stockcode=&channelId=10743%2C10744%2C10012&extGGDL=&order=createTime%7Cdesc%2Cstockcode%7Casc&isPagination=true&pageHelp.pageSize=15&pageHelp.pageNo=1&pageHelp.beginPage=1&pageHelp.cacheSize=1&pageHelp.endPage=5&_=1498029409382’session = requests.session()session.headers.update({ ’Referer’: ’http://www.sse.com.cn/disclosure/credibility/supervision/inquiries/’, ’User-Agent’: ’Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36’})result = session.get(url).json()print result

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 泗洪县| 昭苏县| 婺源县| 休宁县| 翁牛特旗| 钟山县| 霍城县| 虎林市| 玉林市| 巴彦淖尔市| 绥化市| 阳朔县| 宁明县| 宁德市| 沾化县| 凤阳县| 通河县| 夏邑县| 微山县| 昌邑市| 德化县| 如东县| 新干县| 隆昌县| 财经| 德化县| 漳平市| 垣曲县| 阿荣旗| 麻城市| 堆龙德庆县| 封丘县| 齐齐哈尔市| 新平| 吴堡县| 会理县| 那曲县| 台中县| 务川| 商南县| 睢宁县|