# -*- coding:utf-8 -*-
import requests
import re
import random
import time
import json
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import pandas as pd
requests.packages.urllib3.disable_warnings(InsecureRequestWarning) ###禁止提醒SSL警告
class jd(object):
def __init__(self):
self.s = requests.session() ## 创建一个session对象
headers = {
'Accept': '*/*',
'Accept-Language': 'zh-CN',
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) FxiOS/10.6b8836 Mobile/14G60 Safari/603.3.8',
}
self.s.headers.update(headers) ### 设置请求头
def getpid(self,url,name,path):
self.shopid=re.search('index-(.*?).html',url).group(1) ###获取店铺ID号
#searchurl='https://shop.m.jd.com/search/search?shopId=
python爬取京东店铺商品价格数据(已过期)
最新推荐文章于 2024-09-13 16:39:11 发布
该博客分享的Python爬虫代码已过期,京东相关爬虫代码已更新,详情可见作者在CSDN上的最新文章:https://blog.csdn.net/weixin_39416561/article/details/83104837
摘要由CSDN通过智能技术生成