""" :return: """ await self.get_encrypt() async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: if not await self.init(session): println('{}, 无法初始化, 退出程序!'.format(self.account)) return if self.share_code: println('{}, 助力码:{}'.format(self.account, self.share_code)) Code.insert_code(code_key=CODE_JX_PASTURE, code_val=self.share_code, sort=self.sort, account=self.account) await self.get_daily_food(session) await self.sign(session) # 每日签到 await self.get_gold_from_bull(session) # 收牛牛金币 await self.buy_food(session) # 购买白菜 await self.feed(session) # 喂食 await self.mowing(session, max_times=20) # 割草20次 await self.sweep_chicken_legs(session, max_times=20) # 扫鸡腿20次 await self.do_tasks(session) # 做任务领奖励 await self.notify(session) # 通知 if __name__ == '__main__': process_start(JxPasture, '京喜牧场', code_key=CODE_JX_PASTURE)
async def feed_food(self, session, feed_count=80): """ 喂狗, 默认80g """ path = 'pet/feed' params = { 'feedCount': feed_count } data = await self.request(session, path, params) if data and data['errorCode'] and 'ok' in data['errorCode']: println('{}, 成功喂狗一次, 消耗狗粮:{}!'.format(self.account, feed_count)) else: println('{}, 喂狗失败!'.format(self.account)) async def run(self): """ 喂食 :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies, json_serialize=ujson.dumps) as session: await self.feed_food(session, JOY_FEED_COUNT) await close_browser(self.browser) if __name__ == '__main__': from utils.process import process_start from config import JOY_PROCESS_NUM process_start(JdJoyFeed, '宠汪汪喂狗', process_num=JOY_PROCESS_NUM)
message += '【活动入口】京东APP->京东电器->东东工厂\n' self.message = message async def run(self): """ :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: is_success = await self.init(session) if not is_success: println('{}, 无法初始化数据, 退出程序!'.format(self.account)) return await self.collect_electricity(session) task_list = await self.get_task_list(session) await self.do_tasks(session, task_list) await self.notify_result(session) async def run_help(self): """ 助力入口 :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: await self.help_friend(session) if __name__ == '__main__': process_start(JdFactory, '东东工厂', code_key=CODE_JD_FACTORY)
# @File : jx_factory_collect.py # @Cron : 45 */1 * * * # @Desc : 京喜App->我的->京喜工厂, 定时收电量 import aiohttp from jx_factory import JxFactory from utils.console import println from utils.process import process_start from utils.jx_init import jx_init @jx_init class JxFactoryCollect(JxFactory): """ 京喜工厂收电量 """ async def run(self): await self.get_encrypt() async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: success = await self.init(session) if not success: println('{}, 初始化失败!'.format(self.account)) self.message = None return await self.collect_user_electricity(session) await self.collect_friend_electricity(session) if __name__ == '__main__': process_start(JxFactoryCollect, '京喜工厂收电量', help=False)
}) if 'data' in res and 'bizMsg' in res['data']: println('{}, 任务:{}, {}'.format(self.account, task_name, res['data']['bizMsg'])) elif 'errorCode' in res: println('{}, 任务:{}, {}'.format(self.account, task_name, res['errorMessage'])) else: println('{}, 任务:{}, {}'.format(self.account, task_name, res)) await asyncio.sleep(1) async def run(self): """ 入口 :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: println('{}, 正在做任务!'.format(self.account)) for i in range(3): await self.do_task(session) println('{}, 任务已做完!'.format(self.account)) if __name__ == '__main__': from utils.process import process_start process_start(JdCollarBean, '领京豆')
:return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: can_open_reward = await self.can_open_reward(session) if not can_open_reward: println("账号:{}, 当前无法开红包, 退出程序...".format(self.account)) return reward_data = await self.open_reward(session) if not reward_data: println("账号:{}, 当前无法翻倍红包, 退出程序...".format(self.account)) return # 可以翻倍红包 reward_data = await self.doubled_reward(session, reward_data) if not self.can_withdraw: print('账号:{}, 当前无法提取现金, 退出程序...'.format(self.account)) return await asyncio.sleep(0.5) # 可以提现 await self.withdraw(session, reward_data) if __name__ == '__main__': from utils.process import process_start process_start(JdBigWinner, '翻翻乐')
async def run(self): """ 入口 :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: success = await self.init(session) if not success: println('{}, 无法初始化数据, 退出程序!'.format(self.account)) return await self.sign(session) await self.get_share_code(session) await self.do_tasks(session) # await self.get_award(session) await self.withdraw_ten(session) async def run_help(self): """GetSuggestContent?zone=dream_factory&type=1&_time=1628418529947&_stk=_time%2Ctype%2Czone&_ste=1&h5st=20210808182849947%3B4637489386822162%3B10001%3Btk01w9d981bd9a8nU3BBZnNWbHpVdP%2BPHSAkpQ8STHtPYCGIoNHoE4qjMHxdHfHS%2BsnSiGY6mMv%2FRkxxrPkap3g6947E%3Bf98c48ae6521045a461eaa18e9bd1bd3c584c493b1880540dbc19533b0cc7da1&_=1628418529952&sceneval=2&g_login_type=1&callback=jsonpCBKU&g_ty=ls 助力入口 :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: await self.help_friend(session) if __name__ == '__main__': process_start(JdCash, '签到领现金', code_key=CODE_JD_CASH)
if task['taskStatus'] == 3: println('{}, {}已拿到2京豆\n'.format(self.account, task.get('shopName'))) else: res = await self.request(session, 'takeTask', {'taskId': task['taskId']}, method='POST') if res.get('code') == 0: println('{}, 成功完成任务!'.format(self.account)) else: println('{}, 无法完成任务!'.format(self.account)) await asyncio.sleep(1) @logger.catch async def run(self): """ :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: await self.do_tasks(session) if __name__ == '__main__': # from config import JD_COOKIES # app = JdShop(**JD_COOKIES[0]) # asyncio.run(app.run()) from utils.process import process_start process_start(JdShop, '进店领豆')
# @Desc : 汽车生活节 from utils.jd_common import JdCommon from config import USER_AGENT CODE_KEY = 'jd_car_live' class JdCarLive(JdCommon): """ """ code_key = CODE_KEY appid = "1E1xRy6c" # 请求头 headers = { 'Content-Type': 'application/x-www-form-urlencoded', 'Referer': 'https://h5.m.jd.com/babelDiy/Zeus/2FdCyR9rffxKUkMpQTP4WT4bArmL/index.html', 'User-Agent': USER_AGENT } if __name__ == '__main__': from utils.process import process_start process_start(JdCarLive, '汽车生活节', code_key=CODE_KEY) # from config import JD_COOKIES # import asyncio # app = JdCarLive(**JD_COOKIES[0]) # asyncio.run(app.run())
""" res = await self.request(session, 'h5activityIndex') data = res.get('result', None) if not data: return False code = data['redpacketInfo'].get('id', None) if not code: res = await self.request(session, 'h5launch', {"clientInfo": {}, "followShop": 0}) if res.get('biz_code') == 0: code = res['result']['redPacketId'] if not code: println('{}, 获取助力码失败!'.format(self.account)) else: Code.insert_code(code_key=CODE_KEY, code_val=code, account=self.account, sort=self.sort) println('{}, 助力码:{}'.format(self.account, code)) async def run(self): """ :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: await self.do_tasks(session) await self.open_red_packet(session) await self.get_share_code(session) if __name__ == '__main__': process_start(JdKoiRedPacket, '锦鲤红包', code_key=CODE_KEY)
from config import USER_AGENT @jd_init class JdGoodMorning: headers = { 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate, br', 'User-Agent': USER_AGENT, 'Accept-Language': 'zh-Hans-CN;q=1', 'Host': 'api.m.jd.com' } @logger.catch async def run(self): async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: url = 'https://api.m.jd.com/client.action?functionId=morningGetBean&area=22_1930_50948_52157&body=%7B%22rnVersion%22%3A%224.7%22%2C%22fp%22%3A%22-1%22%2C%22eid%22%3A%22%22%2C%22shshshfp%22%3A%22-1%22%2C%22userAgent%22%3A%22-1%22%2C%22shshshfpa%22%3A%22-1%22%2C%22referUrl%22%3A%22-1%22%2C%22jda%22%3A%22-1%22%7D&build=167724&client=apple&clientVersion=10.0.6&d_brand=apple&d_model=iPhone12%2C8&eid=eidI1aaf8122bas5nupxDQcTRriWjt7Slv2RSJ7qcn6zrB99mPt31yO9nye2dnwJ/OW%2BUUpYt6I0VSTk7xGpxEHp6sM62VYWXroGATSgQLrUZ4QHLjQw&isBackground=N&joycious=60&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&openudid=32280b23f8a48084816d8a6c577c6573c162c174&osVersion=14.4&partner=apple&rfs=0000&scope=01&screen=750%2A1334&sign=0c19e5962cea97520c1ef9a2e67dda60&st=1625354180413&sv=112&uemps=0-0&uts=0f31TVRjBSsqndu4/jgUPz6uymy50MQJSPYvHJMKdY9TUw/AQc1o/DLA/rOTDwEjG4Ar9s7IY4H6IPf3pAz7rkIVtEeW7XkXSOXGvEtHspPvqFlAueK%2B9dfB7ZbI91M9YYXBBk66bejZnH/W/xDy/aPsq2X3k4dUMOkS4j5GHKOGQO3o2U1rhx5O70ZrLaRm7Jy/DxCjm%2BdyfXX8v8rwKw%3D%3D&uuid=hjudwgohxzVu96krv/T6Hg%3D%3D&wifiBssid=c99b216a4acd3bce759e369eaeeafd7' response = await session.get(url) text = await response.text() data = json.loads(text) println('{}, 早起福利执行结果:{}'.format(self.account, data)) if __name__ == '__main__': from utils.process import process_start process_start(JdGoodMorning, '早起福利')
elif 'taskCode' in res['result'] and res['result']['taskCode'] == '103': println('{}, 为商品: 《{}》投票失败, {}!'.format(self.account, sku['name'], res['result']['taskMsg'])) else: println('{}, 为商品:《{}》投票成功, 获得京豆:{}'.format(self.account, sku['name'], res['result']['lotteryScore'])) for task in task_list: if task[0]['taskStatus'] == 2: continue body = { "taskId": int(task[0]['taskId']), "itemId": task[0]['taskItemInfo']['itemId'], "type": 2, "batchId": subject['batchId'] } res = await self.request(session, 'goldCreatorDoTask', body) println('{}, 做额外任务: 《{}》, 结果:{}!'.format(self.account, task[0]['taskItemInfo']['title'], res)) async def run(self): """ :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: await self.do_vote(session) # 投票 if __name__ == '__main__': from utils.process import process_start process_start(JdGoldCreator, '金榜创造营')
入口函数 :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: task_list = await self.get_task_list(session) for j in range(len(task_list)): task = task_list[j] println('账号: {}, 任务:{}, 进度:{}...'.format( self.account, task['flexibleData']['taskName'], task['flexibleData']['taskProgress'])) if task['joinTimes'] == task['taskLimit']: self.result.append('任务:{}, 进度:{}...'.format( task['flexibleData']['taskName'], task['flexibleData']['taskProgress'])) for i in range(task['joinTimes'], task['taskLimit']): println('账号: {}, 去完成{}, 第{}次!'.format( self.account, task['flexibleData']['taskName'], i + 1)) en_award_k = task['enAwardK'] await self.do_task(session, en_award_k) await self.lottery(session) # 抽奖 if __name__ == '__main__': from utils.process import process_start process_start(JdLuckyTurntable, name='幸运大转盘')
# @Cron : 40 */2 * * * # @Desc : 种豆得豆收营养液 import aiohttp from utils.console import println from utils.process import process_start from jd_planting_bean import JdPlantingBean class JdPlantingBeanCollect(JdPlantingBean): """ 种豆得豆收营养夜 """ async def run(self): """ :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: self.message = None is_success = await self.planting_bean_index(session) if not is_success: println('{}, 无法获取活动数据!'.format(self.account)) return await self.receive_nutrient(session) await self.collect_nutriments(session) self.message = None if __name__ == '__main__': process_start(JdPlantingBeanCollect, '种豆得豆收营养液', help=False)
help_message = res.get('data', dict()).get('helpToast') println('{}, 助力好友:{}, {}'.format(self.account, account, help_message)) if '上限' in help_message: break await asyncio.sleep(1) except Exception as e: println('{}, 助力好友失败, {}!'.format(self.account, e.args)) continue async def run(self): """ :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: await self.get_share_code(session) async def run_help(self): async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: await self.help(session) if __name__ == '__main__': from utils.process import process_start process_start(JdGrabBean, '抢京豆', code_key=CODE_JD_GRAB_BEAN)
task['taskName'])) await asyncio.sleep(2) async def notify(self, session): # 刷新金币数据 await self.get_task_list(session) self.message = '【活动名称】京东赚赚\n【活动入口】微信小程序-京东赚赚\n' \ '【京东账号】{}\n【金币总数】{}\n【可提现金额】{}¥\n' \ ''.format(self.account, self.total_gold, round(self.total_gold / self.cash_ratio, 2)) async def run(self): """ 程序入口 :return: """ async with aiohttp.ClientSession( headers=self.headers, cookies=self.cookies, json_serialize=ujson.dumps) as session: task_list = await self.get_task_list(session) if not task_list: println('{}, 无法获取活动数据, 退出程序!'.format(self.account)) return await self.do_tasks(session, task_list) await self.notify(session) if __name__ == '__main__': process_start(JdEarn, '京东赚赚')
#!/usr/local/bin/python # -*- coding: utf-8 -*- # @Time : 2021/8/7 下午11:14 # @Project : jd_scripts # @File : jd_health_collect.py # @Cron : 0 */30 * * * # @Desc : 东东健康社区收能量 import aiohttp from jd_health import JdHealth from utils.process import process_start class JdHealthCollect(JdHealth): """ 东东健康社区收能量 """ async def run(self): """ :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: await self.collect_health_energy(session) if __name__ == '__main__': process_start(JdHealthCollect, '东东健康社区收能量', help=False)
@logger.catch async def apply_for_trial(self, session, goods_list): """ 申请试用 :param session: :param goods_list: :return: """ println(len(goods_list)) for goods in goods_list: data = await self.trial(session, goods) println('{}, 商品:《{}》, {}'.format(self.account, goods['name'], data.get('message'))) if data.get('code') == '-131': # 今日已上限 break await asyncio.sleep(5) @logger.catch async def run(self): """ :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: goods_list = await self.get_goods_list(session) await self.apply_for_trial(session, goods_list) if __name__ == '__main__': process_start(JdTry, '京东试用')
# @Time : 2021/8/15 上午11:16 # @Project : jd_scripts # @File : jd_magic.py # @Cron : 37 3,12 * * * # @Desc : from utils.jd_common import JdCommon from config import USER_AGENT CODE_KEY = 'jd_magic' class JdMagic(JdCommon): """ """ code_key = CODE_KEY appid = "1E1NYwqc" # 请求头 headers = { 'Content-Type': 'application/x-www-form-urlencoded', 'Referer': 'https://h5.m.jd.com/babelDiy/Zeus/3RejAk5YXzhvxXiBR1tzWnUbwneW/index.html', 'User-Agent': USER_AGENT } if __name__ == '__main__': from utils.process import process_start process_start(JdMagic, '荣耀换新季', code_key=CODE_KEY)
:return: """ bean_data = await self.total_bean(session) # 京豆统计数据 red_packet_data = await self.total_red_packet(session) # 红包统计数据 message = '【京东账号】{}\n'.format(self.account) message += '【京豆总数】{}\n'.format(bean_data['bean_amount']) message += '【今日收入】{}京豆\n'.format(bean_data['today_income']) message += '【今日支出】{}京豆\n'.format(bean_data['today_used']) message += '【昨日收入】{}京豆\n'.format(bean_data['yesterday_income']) message += '【昨日支出】{}京豆\n'.format(bean_data['yesterday_used']) for item in bean_data['expire']: message += item + '\n' message += '【当前红包余额】{}¥\n'.format(red_packet_data['total_amount']) message += '【即将过期红包】{}¥\n'.format(red_packet_data['expire_amount']) self.message = message async def run(self): """ 程序入库 :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: await self.notify(session) if __name__ == '__main__': from utils.process import process_start process_start(JdBeanChange, '资产变动通知')
await self.initiate_help(session) await self.get_task_award(session, task) else: await self.receive_task(session, task) async def run(self): """ 程序入口 :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: dj_cookies = await self.login(session) if not dj_cookies: return println('{}, 登录成功...'.format(self.account)) async with aiohttp.ClientSession(cookies=dj_cookies, headers=self.headers) as session: activity_info = await self.get_activity_info(session) if not activity_info: println('{}, 获取活动ID失败, 退出程序!'.format(self.account)) return await self.do_task(session) if __name__ == '__main__': from utils.process import process_start process_start(DjBeanManor, '鲜豆庄园任务')
助力入口 :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: is_success = await self.login(session) if not is_success: println('{}, 登录失败, 退出程序...'.format(self.account)) return item_list = Code.get_code_list(CODE_MONEY_TREE) item_list.extend(get_code_list(CODE_MONEY_TREE)) for item in item_list: friend_account, friend_code = item.get('account'), item.get('code') if friend_account == self.account: continue params = { "sharePin": friend_account, "shareType": "1", "channelLV": "", "source": 0, "riskDeviceParam": "{}" } data = await self.request(session, 'login', params) if data['code'] == '200': println('{}, 正在帮好友:{}打工!'.format(self.account, friend_account)) else: println('{}, 无法为好友:{}打工!'.format(self.account, friend_account)) if __name__ == '__main__': process_start(JrMoneyTree, '金果摇钱树', code_key=CODE_MONEY_TREE)
async def run(self): """ :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: self.message = '【活动名称】东东萌宠\n【京东账号】{}\n'.format(self.account) is_success = await self.init(session) if not is_success: println('{}, 初始化失败, 退出程序!'.format(self.account)) return task_list = await self.get_task_list(session) await self.do_tasks(session, task_list) await self.pet_sport(session) await self.feed_food_again(session) # 再次喂食 await self.collect_energy(session) await self.get_friend_help_award(session) self.message += '【活动入口】京东APP->我的->东东萌宠\n' async def run_help(self): """ 助力入口 :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: await self.help_friend(session) if __name__ == '__main__': process_start(JdCutePet, '东东萌宠', code_key=CODE_CUT_PET)
}) curr_level_count = data['resultData']['resultData']['cote']['pig'][ 'currLevelCount'] # 当前等级需要喂养的次数 curr_count = data['resultData']['resultData']['cote']['pig'][ 'currCount'] # 当前等级已喂猪的次数 curr_level = data['resultData']['resultData']['cote']['pig'][ 'curLevel'] curr_level_message = '成年期' if curr_level == 3 else '哺乳期' pig_id = data['resultData']['resultData']['cote']['pig']['pigId'] data = await self.request( session, 'pigPetMyWish1', { "pigId": pig_id, "channelLV": "", "source": 0, "riskDeviceParam": "{}" }) award_name = data['resultData']['resultData']['award']['name'] award_tips = data['resultData']['resultData']['award']['content'] message = '\n【活动名称】{}\n【用户ID】{}\n【奖品名称】{}\n【完成进度】{}\n【小提示】{}'.format( '京东金融养猪猪', self.account, award_name, '{}:{}/{}'.format(curr_level_message, curr_count, curr_level_count), award_tips) self.message = message except Exception as e: println(e.args) if __name__ == '__main__': process_start(JrPetPig, '养猪猪')
if item['status'] == 10: println('{}, 今日已领取过《{}》的卡片!'.format( self.account, item['name'])) continue jump_type = item.get('jumpType') if jump_type == 41: await self.visit_jc(session) await asyncio.sleep(1) elif jump_type == 31: await self.sign(session) await asyncio.sleep(1) data = await self.get_index_data(session) for item in data: if item['status'] == 11: for no in item['getRewardNos']: await self.get_card(session, no) await asyncio.sleep(1) await self.synthesis(session) if __name__ == '__main__': # from config import JD_COOKIES # app = JdAmusementPost(**JD_COOKIES[8]) # asyncio.run(app.run()) from utils.process import process_start process_start(JdAmusementPost, '京小鸽-游乐寄', code_key=CODE_AMUSEMENT_POST)
url = 'https://api.m.jd.com/client.action?functionId=lotteryDraw&body=%7B%22actId%22%3A%22jgpqtzjhvaoym%22%2C' \ '%22appSource%22%3A%22jdhome%22%2C%22lotteryCode%22%3A' \ '%223zt5mf6evl5h4oe4mwfpueshk5nsyuqrssvzwf55qfcenlog7kavbf5cyrs6kbnphiawzpccizuck%22%7D&appid=ld&client' \ '=android&clientVersion=&networkType=wifi&osVersion=&uuid=&jsonp=jsonp_1624843889411_61314' try: response = await session.get(url=url) text = await response.text() text = re.findall(r'\((.*?)\);', text)[0] data = json.loads(text) if data['code'] != '0': println('{}, 抽京豆失败, {}'.format(self.account, data)) elif 'errorMessage' in data: println('{}, 抽京豆失败, {}'.format(self.account, data['errorMessage'])) else: println('{}, 抽京豆成功, 中奖信息: {}'.format(self.account, data['data']['toastTxt'])) except Exception as e: println('{}, 抽京豆错误!{}'.format(self.account, e.args)) async def run(self): """ 程序入口 :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: await self.lottery(session) if __name__ == '__main__': process_start(JdLotteryBean, '抽京豆')
println('{}, 奖品:{}已无库存!'.format(self.account, gift_name)) break else: println('{}, 兑换请求结果: {}'.format(self.account, data)) await asyncio.sleep(0.2) if exchange_finish: break if exchange_success: println('{}, 成功兑换商品:{}, 兑换时间:{}'.format(self.account, exchange_name, exchange_success_datetime)) self.message = '【活动名称】宠汪汪\n【京东账号】{}\n【兑换奖品】{}\n【兑换状态】成功\n【兑换时间】{}\n'.\ format(self.account, exchange_name, exchange_success_datetime) async def run(self): async with aiohttp.ClientSession( headers=self.headers, cookies=self.cookies, json_serialize=ujson.dumps) as session: await self.exchange_bean(session) await close_browser(self.browser) if __name__ == '__main__': from utils.process import process_start from config import JOY_PROCESS_NUM process_start(JdJoyExchange, '宠汪汪兑换', process_num=JOY_PROCESS_NUM)
self.message = message println('{}, 获取资产变动信息完成...'.format(self.account)) async def run(self): """ 程序入口 :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: dj_cookies = await self.login(session) if not dj_cookies: return println('{}, 登录成功...'.format(self.account)) async with aiohttp.ClientSession(cookies=dj_cookies, headers=self.headers) as session: success = await self.init(session) if not success: println('{}, 初始化失败, 退出程序!'.format(self.account)) return await self.daily_sign(session) await self.do_task(session) await self.bean_change(session) if __name__ == '__main__': from utils.process import process_start process_start(DjBean, '京东到家-赚鲜豆')
if not shop_id_list: break cur_page += 1 await asyncio.sleep(1.5) unfollow_path = '/fav/shop/batchunfollow' unfollow_params = { 'shopId': ','.join(shop_id_list) } data = await self.request(session, unfollow_path, unfollow_params) if data.get('iRet', '-1') == '0': println('{}, 成功取关{}个店铺!'.format(self.account, len(shop_id_list))) else: println(data) await asyncio.sleep(1) async def run(self): """ :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: await self.unsubscribe_goods(session) await self.unsubscribe_shops(session) if __name__ == '__main__': process_start(JdUnsubscribe, '取消商品关注和店铺关注')
# @Cron : 42 */1 * * * # @Desc : 京东APP->京东到家->免费水果, 定时领水滴/浇水 import aiohttp from dj_fruit import DjFruit from utils.console import println from utils.process import process_start from config import DJ_FRUIT_KEEP_WATER class DjFruitCollect(DjFruit): async def run(self): """ :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: dj_cookies = await self.login(session) if not dj_cookies: return println('{}, 登录成功...'.format(self.account)) async with aiohttp.ClientSession(cookies=dj_cookies, headers=self.headers) as session: await self.receive_water_wheel(session) # 领取水车水滴 await self.watering(session, keep_water=DJ_FRUIT_KEEP_WATER) if __name__ == '__main__': process_start(DjFruitCollect, '到家果园领水滴')