| 56 | notify(f"任务:全名抽免单\n时间:{time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())}") |
| 57 | |
| 58 | class Double11: |
| 59 | def __init__(self,dic): |
| 60 | self.dic = dic |
| 61 | self.sess = requests.session() |
| 62 | |
| 63 | # 登录验证 |
| 64 | def login(self): |
| 65 | url = 'https://store.oppo.com/cn/oapi/users/web/member/check' |
| 66 | headers = { |
| 67 | 'Host': 'store.oppo.com', |
| 68 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', |
| 69 | 'Content-Type': 'application/x-www-form-urlencoded', |
| 70 | 'Connection': 'keep-alive', |
| 71 | 'Accept-Language': 'zh-cn', |
| 72 | 'Accept-Encoding': 'gzip, deflate, br', |
| 73 | } |
| 74 | response = self.sess.get(url=url,headers=headers).json() |
| 75 | if response['code'] == 200: |
| 76 | notify(f"{self.dic['user']}\t登录成功") |
| 77 | return True |
| 78 | else: |
| 79 | notify(f"{self.dic['user']}\t登录失败") |
| 80 | return False |
| 81 | |
| 82 | # 秒杀详情页获取商品数据 |
| 83 | def getGoodMess(self,count=10): |
| 84 | taskUrl = f'https://msec.opposhop.cn/goods/v1/SeckillRound/goods/{random.randint(100,250)}' # 随机商品 |
| 85 | headers = { |
| 86 | 'clientPackage': 'com.oppo.store', |
| 87 | 'Host': 'msec.opposhop.cn', |
| 88 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', |
| 89 | 'Content-Type': 'application/x-www-form-urlencoded', |
| 90 | 'Connection': 'keep-alive', |
| 91 | 'User-Agent': 'okhttp/3.12.12.200sp1', |
| 92 | 'Accept-Encoding': 'gzip', |
| 93 | } |
| 94 | params = { |
| 95 | 'pageSize':count + random.randint(1,3) |
| 96 | } |
| 97 | response = self.sess.get(url=taskUrl,headers=headers,params=params).json() |
| 98 | if response['meta']['code'] == 200: |
| 99 | return response |
| 100 | |
| 101 | def viewGoods(self, count,dic=None): |
| 102 | headers = { |
| 103 | 'clientPackage': 'com.oppo.store', |
| 104 | 'Host': 'msec.opposhop.cn', |
| 105 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', |
| 106 | 'Content-Type': 'application/x-www-form-urlencoded', |
| 107 | 'Connection': 'keep-alive', |
| 108 | 'User-Agent': 'okhttp/3.12.12.200sp1', |
| 109 | 'Accept-Encoding': 'gzip' |
| 110 | } |
| 111 | result = self.getGoodMess(count=count) # 秒杀列表存在商品url |
| 112 | if result['meta']['code'] == 200: |
| 113 | for each in result['detail']: |
| 114 | url = f"https://msec.opposhop.cn/goods/v1/info/sku?skuId={each['skuid']}" |
| 115 | self.sess.get(url=url,headers=headers) |