├── .gitignore ├── LICENSE ├── README.md ├── main.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | build 3 | dist 4 | main.spec 5 | log.log -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 hyzaw 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JDMemberCloseLinks 2 | 3 | 本项目旨在使用京东cookie一键生成所有退会链接 4 | 5 | 本项目大部分代码基于 https://github.com/yqchilde/JDMemberCloseAccount (MIT协议开源) 6 | 7 | ## 使用方法 8 | 9 | 1. 克隆到本地 10 | 11 | ```shell 12 | git clone https://github.com/hyzaw/JDMemberCloseLinks.git 13 | ``` 14 | 15 | 2. 安装所需要的依赖包 16 | 17 | ``` 18 | pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple 19 | ``` 20 | 21 | 3. 运行程序 22 | 23 | ``` 24 | python3 main.py 25 | ``` 26 | 27 | ## 链接使用方法 28 | 29 | 手机:把所有链接复制到京东客户端的客服聊天窗口后打开 30 | 31 | 电脑:先在 https://home.m.jd.com/ 登录账号后将链接依次复制到浏览器打开 32 | 33 | ## 注意 34 | 35 | 由于,脚本运行时需要连接到京东,需要国内ip连接。使用代理时如果出现闪退或报错,请尝试关闭代理软件! 36 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from requests import post 2 | from sys import exit as sys_exit 3 | from json import loads as json_loads 4 | import logging 5 | 6 | 7 | def get_shop_cards(ck): 8 | """ 9 | 获取加入店铺列表 10 | :return: 返回店铺列表 11 | """ 12 | 13 | url = "https://api.m.jd.com/client.action?functionId=getWalletReceivedCardList_New&clientVersion=9.5.2&build" \ 14 | "=87971&client=android&d_brand=Xiaomi&d_model=M2007J3SC&osVersion=11&screen=2266*1080&partner=xiaomi001" \ 15 | "&oaid=e02a70327f315862&openudid=3dab9a16bd95e38a&eid=eidA24e181233bsdmxzC3hIpQF2nJhWGGLb" \ 16 | "%2F1JscxFOzBjvkqrXbFQyAXZmstKs0K6bUwkQ0D3s1%2F7MzLZ7JDdhztfcdZur9xPTxU1ahqtHWYb54%2FyNK&sdkVersion=30" \ 17 | "&lang=zh_CN&uuid=3dab9a16bd95e38a&aid=3dab9a16bd95e38a&area=13_1000_40488_54442&networkType=wifi" \ 18 | "&wifiBssid=c609e931512437a8806ae06b86d3977b&uts=0f31TVRjBSsu47QjbY5aZUsO5LYa1B%2F3wqL7JjlFB60vmw6" \ 19 | "%2F8Xbj74d3sWoT4CTQgX7X0M07W75JvIfz5eu7NxdNJ73NSVbgTHkdsiVZ770PEn0MWPywxr4glUdddS6uxIQ5VfPG65uoUmlB6" \ 20 | "%2BBwwDqO1Nfxv8%2Bdm15xR%2BFG4fJWb6wCFO7DFMtnoOMo2CQ8mYoECYG3qT%2Bso7P%2FKLgQcg%3D%3D&uemps=0-0&st" \ 21 | "=1620105615175&sign=65996ece830b41aabdaba32c9d782d07&sv=100" 22 | payload = "body=%7B%22v%22%3A%224.1%22%2C%22version%22%3A1580659200%7D&" 23 | headers = { 24 | 'Host': 'api.m.jd.com', 25 | 'cookie': ck, 26 | 'charset': 'UTF-8', 27 | 'accept-encoding': 'br,gzip,deflate', 28 | 'user-agent': 'okhttp/3.12.1;jdmall;android;version/9.5.2;build/87971;screen/1080x2266;os/11;network/wifi;', 29 | 'cache-control': 'no-cache', 30 | 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', 31 | 'content-length': '60' 32 | } 33 | proxies = { "http": None, "https": None} 34 | card_list = [] 35 | resp = post(url, headers=headers, data=payload, proxies=proxies) 36 | ret = json_loads(resp.text) 37 | if ret["code"] == "0": 38 | if ret["message"] == "用户未登录": 39 | logger.info("请输入正确的京东cookie") 40 | sys_exit(1) 41 | 42 | if "cardList" not in ret["result"]: 43 | logger.info("当前卡包中会员店铺为0个") 44 | sys_exit(1) 45 | 46 | card_list = (ret["result"]["cardList"]) 47 | else: 48 | print("echo") 49 | 50 | return card_list 51 | 52 | ck = input("请输入你的京东cookie(含有py_key和pt_pin):") 53 | card_list = get_shop_cards(ck) 54 | 55 | # 配置logging输出日志 56 | logger = logging.getLogger() 57 | logger.setLevel(logging.INFO) 58 | formatter = logging.Formatter('') 59 | # 使用FileHandler输出到文件 60 | fh = logging.FileHandler('log.log',mode='w') 61 | fh.setLevel(logging.INFO) 62 | fh.setFormatter(formatter) 63 | # 使用StreamHandler输出到屏幕 64 | ch = logging.StreamHandler() 65 | ch.setLevel(logging.INFO) 66 | ch.setFormatter(formatter) 67 | # 添加两个Handler 68 | logger.addHandler(ch) 69 | logger.addHandler(fh) 70 | 71 | # 判定一下是否有会员卡 72 | if len(card_list) == 0: 73 | logger.info ("当前没有加入的店铺信息") 74 | sys_exit (0) 75 | 76 | logger.info("本次运行获取到" + str(len(card_list)) + "家店铺会员信息") 77 | 78 | for card in card_list: 79 | logger.info("会员名称:" + card["brandName"]) 80 | logger.info("注销地址:https://shopmember.m.jd.com/member/memberCloseAccount?venderId=" + card["brandId"]) 81 | 82 | 83 | logger.info("\n\n本项目开源地址为:https://www.github.com/hyzaw/JDMemberCloseLinks") 84 | 85 | 86 | input("按回车退出程序") 87 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | urllib3==1.25.7 2 | requests~=2.25.1 --------------------------------------------------------------------------------