diff --git a/docs/config/README.md b/docs/config/README.md index c8eab0753d538b4afa5cffcca1a4fda39d331113..889745541871665b4b8fa07f82329998d81ff97e 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -25,9 +25,12 @@ account = 150******** # 明文例如:123456abcd # MD5例如:efa224f8de55cb668cd01edbccdfc8a9 password = bfa834f7de58cb650ca01edb******** + +# 国家码,用于国外手机号登陆,国内为86 +countrycode = 86 ``` -`token`区域下存放个人账号信息,account存放网易云账号,password存放密码 +`token`区域下存放个人账号信息,`account`存放网易云账号,`password`存放密码,`countrycode`为手机号的国家码 !> 注意,这里密码填写类型与后面的md5开关相关联,具体见后面介绍 diff --git a/docs/document/README.md b/docs/document/README.md index 108422cb5885c0d00f2408d594cead356fd32add..6958c4c4fd8df25b17cb0397f0bdaa99124ee600 100644 --- a/docs/document/README.md +++ b/docs/document/README.md @@ -32,7 +32,11 @@ MD5例如:efa224f8de55cb668cd01edbccdfc8a9 **接口地址 :** `/?do=login` -**可选参数 :** `r`: 0至1的随机数,例如`0.20246864764818318` +**可选参数 :** + +`countrycode`: 国家码,用于国外手机号登陆,例如美国传入:`1`,默认国内为86 + +`r`: 0至1的随机数,例如`0.20246864764818318` **调用例子 :** `/?do=login&uin=xxx&pwd=yyy` diff --git a/index.py b/index.py index 6a2706f907f877cd0b6637f09fa8474c06a6a451..8ae4ee40e11daa121284287d4cdd3b2d87e3aca0 100644 --- a/index.py +++ b/index.py @@ -1,10 +1,10 @@ #coding:utf-8 ''' @author: ZainCheung -@LastEditors: Daphel +@LastEditors: ZainCheung @description:网易云音乐全自动每日打卡云函数版 @Date: 2020-06-25 14:28:48 -@LastEditTime: 2020-08-20 10:16:15 +@LastEditTime: 2020-09-01 18:20:00 ''' from configparser import ConfigParser from threading import Timer @@ -26,9 +26,10 @@ class Task(object): ''' 对象的构造函数 ''' - def __init__(self, uin, pwd, sckey): + def __init__(self, uin, pwd, sckey, countrycode=86): self.uin = uin self.pwd = pwd + self.countrycode = countrycode self.sckey = sckey ''' @@ -45,7 +46,7 @@ class Task(object): 登录 ''' def login(self): - data = {"uin":self.uin,"pwd":self.pwd,"r":random.random()} + data = {"uin":self.uin,"pwd":self.pwd,"countrycode":self.countrycode,"r":random.random()} if '@' in self.uin: url = api + '?do=email' else: @@ -114,9 +115,9 @@ class Task(object): content:消息的内容,支持MarkDown格式 ''' def diyText(self): - today = datetime.date.today() - kaoyan_day = datetime.date(2020,12,21) #2021考研党的末日 - date = (kaoyan_day - today).days + # today = datetime.date.today() + # kaoyan_day = datetime.date(2020,12,21) #2021考研党的末日 + # date = (kaoyan_day - today).days one = requests.get('https://api.qinor.cn/soup/').text # 每日一句的api for count in grade: if self.level < 10: @@ -149,8 +150,6 @@ class Task(object): "------\n" "#### 打卡日志\n" + self.dakaSongs_list + "\n\n" "------\n" - "#### 考研倒计时\n- 距考研还有" + str(date) + "天,主人要加油学习啊!\n\n" - "------\n" "#### 今日一句\n- " + one + "\n\n") ''' @@ -207,6 +206,7 @@ def init(): config.read('init.config', encoding='UTF-8-sig') uin = config['token']['account'] pwd = config['token']['password'] + countrycode = config['token']['countrycode'] api = config['setting']['api'] md5Switch = config.getboolean('setting','md5Switch') peopleSwitch = config.getboolean('setting','peopleSwitch') @@ -215,6 +215,7 @@ def init(): conf = { 'uin': uin, 'pwd': pwd, + 'countrycode': countrycode, 'api': api, 'md5Switch': md5Switch, 'peopleSwitch':peopleSwitch, @@ -273,7 +274,7 @@ def taskPool(): if config['md5Switch'] is True: logger.info('MD5开关已打开,即将开始为你加密,密码不会上传至服务器,请知悉') config['pwd'] = md5(config['pwd']) - task = Task(config['uin'], config['pwd'], config['sckey']) + task = Task(config['uin'], config['pwd'], config['sckey'], config['countrycode']) task.start() ''' diff --git a/init.config b/init.config index a682a2ebf2964d818d4e800033d9afb0c665634e..8cb700f1d6409e2689c5449cf7328916998bcf84 100644 --- a/init.config +++ b/init.config @@ -9,10 +9,13 @@ account = 150******** # MD5例如:efa224f8de55cb668cd01edbccdfc8a9 password = bfa834f7de58cb650ca01edb******** +# 国家码,用于国外手机号登陆,国内为86 +countrycode = 86 + [setting] # 开关的选项只有 True 和 False -# 打卡网站的网址,如果失效请提issue:https://github.com/ZainCheung/netease-cloud-api/issues/new +# 接口API,如果失效请自行部署,地址:https://github.com/ZainCheung/netease-cloud-api api = https://netease-cloud-api.glitch.me/ # 密码是否需要MD5加密,如果是明文密码一定要打开 diff --git a/main.py b/main.py index 37237efe6663ac7f540b5048ab17fe4385163272..1084e5a815c535e0fce01e4a755579197a9b8bb0 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,10 @@ #coding:utf-8 ''' @author: ZainCheung -@LastEditors: Daphel +@LastEditors: ZainCheung @description:网易云音乐全自动每日打卡300首歌升级账号等级,使用前请先到init.config文件配置 @Date: 2020-06-25 14:28:48 -@LastEditTime: 2020-08-20 09:50:18 +@LastEditTime: 2020-09-01 18:20:00 ''' from configparser import ConfigParser from threading import Timer @@ -23,7 +23,7 @@ import os ''' os.chdir(os.path.dirname(os.path.abspath(__file__))) logFile = open("run.log", encoding="utf-8", mode="a") -logging.basicConfig(stream=logFile, format="%(asctime)s %(name)s:%(levelname)s:%(message)s", datefmt="%Y-%m-%d %H:%M:%S", level=logging.INFO) +logging.basicConfig(stream=logFile, format="%(asctime)s %(levelname)s:%(message)s", datefmt="%Y-%m-%d %H:%M:%S", level=logging.INFO) grade = [10,40,70,130,200,400,1000,3000,8000,20000] api = '' @@ -32,9 +32,10 @@ class Task(object): ''' 对象的构造函数 ''' - def __init__(self, uin, pwd, sckey): + def __init__(self, uin, pwd, sckey, countrycode=86): self.uin = uin self.pwd = pwd + self.countrycode = countrycode self.sckey = sckey ''' @@ -51,7 +52,7 @@ class Task(object): 登录 ''' def login(self): - data = {"uin":self.uin,"pwd":self.pwd,"r":random.random()} + data = {"uin":self.uin,"pwd":self.pwd,"countrycode":self.countrycode,"r":random.random()} if '@' in self.uin: url = api + '?do=email' else: @@ -126,9 +127,9 @@ class Task(object): content:消息的内容,支持MarkDown格式 ''' def diyText(self): - today = datetime.date.today() - kaoyan_day = datetime.date(2020,12,21) #2021考研党的末日 - date = (kaoyan_day - today).days + # today = datetime.date.today() + # kaoyan_day = datetime.date(2020,12,21) #2021考研党的末日 + # date = (kaoyan_day - today).days one = requests.get('https://api.qinor.cn/soup/').text # 每日一句的api for count in grade: if self.level < 10: @@ -163,8 +164,6 @@ class Task(object): "------\n" "#### 打卡日志\n" + self.dakaSongs_list + "\n\n" "------\n" - "#### 考研倒计时\n- 距考研还有" + str(date) + "天,主人要加油学习啊!\n\n" - "------\n" "#### 今日一句\n- " + one + "\n\n") ''' @@ -228,6 +227,7 @@ def init(): config.read('init.config', encoding='UTF-8-sig') uin = config['token']['account'] pwd = config['token']['password'] + countrycode = config['token']['countrycode'] api = config['setting']['api'] md5Switch = config.getboolean('setting','md5Switch') peopleSwitch = config.getboolean('setting','peopleSwitch') @@ -237,6 +237,7 @@ def init(): conf = { 'uin': uin, 'pwd': pwd, + 'countrycode': countrycode, 'api': api, 'md5Switch': md5Switch, 'peopleSwitch':peopleSwitch, @@ -302,7 +303,7 @@ def taskPool(): print('MD5开关已打开,即将开始为你加密,密码不会上传至服务器,请知悉') logging.info('MD5开关已打开,即将开始为你加密,密码不会上传至服务器,请知悉') config['pwd'] = md5(config['pwd']) - task = Task(config['uin'], config['pwd'], config['sckey']) + task = Task(config['uin'], config['pwd'], config['sckey'], config['countrycode']) task.start() ''' diff --git a/run.log b/run.log new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391