Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wk1234123
netease-cloud
提交
bdbf3bd0
N
netease-cloud
项目概览
wk1234123
/
netease-cloud
与 Fork 源项目一致
Fork自
ZainCheung / netease-cloud
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
netease-cloud
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
bdbf3bd0
编写于
8月 20, 2020
作者:
Z
Zain
提交者:
GitHub
8月 20, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #25 from Daphel/develop
优化推送
上级
1d22b2e6
430daccf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
101 addition
and
52 deletion
+101
-52
index.py
index.py
+48
-31
main.py
main.py
+53
-21
未找到文件。
index.py
浏览文件 @
bdbf3bd0
#coding:utf-8
'''
@author: ZainCheung
@LastEditors:
ZainCheung
@LastEditors:
Daphel
@description:网易云音乐全自动每日打卡云函数版
@Date: 2020-06-25 14:28:48
@LastEditTime: 2020-0
6-26 17:38:18
@LastEditTime: 2020-0
8-20 10:16:15
'''
from
configparser
import
ConfigParser
from
threading
import
Timer
...
...
@@ -15,6 +15,7 @@ import datetime
import
time
import
json
import
logging
import
math
logger
=
logging
.
getLogger
()
grade
=
[
10
,
40
,
70
,
130
,
200
,
400
,
1000
,
3000
,
8000
,
20000
]
...
...
@@ -41,7 +42,7 @@ class Task(object):
return
response
'''
登
陆
登
录
'''
def
login
(
self
):
data
=
{
"uin"
:
self
.
uin
,
"pwd"
:
self
.
pwd
,
"r"
:
random
.
random
()}
...
...
@@ -56,10 +57,9 @@ class Task(object):
if
code
==
200
:
self
.
error
=
''
else
:
self
.
error
=
'登
陆
失败,请检查账号'
self
.
error
=
'登
录
失败,请检查账号'
self
.
cookies
=
response
.
cookies
.
get_dict
()
self
.
log
(
'登陆成功'
)
logger
.
info
(
"登陆成功"
)
self
.
log
(
'登录成功'
)
'''
每日签到
...
...
@@ -70,10 +70,8 @@ class Task(object):
data
=
json
.
loads
(
response
.
text
)
if
data
[
'code'
]
==
200
:
self
.
log
(
'签到成功'
)
logger
.
info
(
'签到成功'
)
else
:
self
.
log
(
'重复签到'
)
logger
.
info
(
'重复签到'
)
'''
每日打卡300首歌
...
...
@@ -94,7 +92,6 @@ class Task(object):
self
.
level
=
data
[
'level'
]
self
.
listenSongs
=
data
[
'listenSongs'
]
self
.
log
(
'获取用户详情成功'
)
logger
.
info
(
'获取用户详情成功'
)
'''
Server推送
...
...
@@ -108,10 +105,8 @@ class Task(object):
data
=
json
.
loads
(
response
.
text
)
if
data
[
'errno'
]
==
0
:
self
.
log
(
'用户:'
+
self
.
name
+
' Server酱推送成功'
)
logger
.
info
(
'用户:'
+
self
.
name
+
' Server酱推送成功'
)
else
:
self
.
log
(
'用户:'
+
self
.
name
+
' Server酱推送失败,请检查sckey是否正确'
)
logger
.
info
(
'用户:'
+
self
.
name
+
' Server酱推送失败,请检查sckey是否正确'
)
'''
自定义要推送到微信的内容
...
...
@@ -130,26 +125,33 @@ class Task(object):
self
.
tip
=
'还需听歌'
+
str
(
count
-
self
.
listenSongs
)
+
'首即可升级'
break
else
:
self
.
tip
=
'你已经听够20000首歌曲,如果登
陆
天数达到800天即可满级'
self
.
tip
=
'你已经听够20000首歌曲,如果登
录
天数达到800天即可满级'
else
:
self
.
tip
=
'恭喜你已经满级!'
if
self
.
error
==
''
:
state
=
'目前已完成签到,300百首歌也已听完'
self
.
title
=
'网易云听歌任务已完成'
state
=
(
"- 目前已完成签到
\n
"
"- 今日共打卡"
+
str
(
self
.
dakanum
)
+
"次
\n
"
"- 今日共播放"
+
str
(
self
.
dakaSongs
)
+
"首歌
\n
"
"- 还需要打卡"
+
str
(
self
.
day
)
+
"天"
)
self
.
title
=
(
"网易云今日打卡"
+
str
(
self
.
dakaSongs
)
+
"首,已播放"
+
str
(
self
.
listenSongs
)
+
"首"
)
else
:
state
=
self
.
error
self
.
title
=
'网易云听歌任务出现问题!'
self
.
content
=
(
"> tip:等级数据每天下午2点更新
\n\n
"
self
.
content
=
(
"------
\n
"
"
| 用户名 | "
+
str
(
self
.
name
)
+
" |
\n
"
"
| -------- | :----------------: |
\n
"
"
| 当前等级 | "
+
str
(
self
.
level
)
+
"级 |
\n
"
"
| 累计播放 | "
+
str
(
self
.
listenSongs
)
+
"首 |
\n
"
"
| 升级提示 | "
+
self
.
tip
+
" |
\n
"
"
#### 账户信息
\n
"
"
- 用户名称:"
+
str
(
self
.
name
)
+
"
\n
"
"
- 当前等级:"
+
str
(
self
.
level
)
+
"级
\n
"
"
- 累计播放:"
+
str
(
self
.
listenSongs
)
+
"首
\n
"
"
- 升级提示:"
+
self
.
tip
+
"
\n
\n
"
"------
\n
"
"### 任务状态
\n
"
+
str
(
state
)
+
"
\n\n
"
"### 考研倒计时
\n
距考研还有"
+
str
(
date
)
+
"天,主人要加油学习啊
\n
"
"### 今日一句
\n
"
+
one
+
"
\n\n
"
)
"#### 任务状态
\n
"
+
str
(
state
)
+
"
\n\n
"
"------
\n
"
"#### 打卡日志
\n
"
+
self
.
dakaSongs_list
+
"
\n\n
"
"------
\n
"
"#### 考研倒计时
\n
- 距考研还有"
+
str
(
date
)
+
"天,主人要加油学习啊!
\n\n
"
"------
\n
"
"#### 今日一句
\n
- "
+
one
+
"
\n\n
"
)
'''
打印日志
...
...
@@ -157,28 +159,43 @@ class Task(object):
def
log
(
self
,
text
):
time_stamp
=
datetime
.
datetime
.
now
()
print
(
time_stamp
.
strftime
(
'%Y.%m.%d-%H:%M:%S'
)
+
' '
+
str
(
text
))
self
.
time
=
time_stamp
.
strftime
(
'%H:%M:%S'
)
self
.
list
.
append
(
"- ["
+
self
.
time
+
"] "
+
str
(
text
)
+
"
\n\n
"
)
'''
开始执行
'''
def
start
(
self
):
try
:
self
.
list
=
[]
self
.
list
.
append
(
"- 初始化完成
\n\n
"
)
self
.
login
()
self
.
sign
()
self
.
detail
()
for
i
in
range
(
1
,
3
):
counter
=
self
.
listenSongs
for
i
in
range
(
1
,
10
):
self
.
daka
()
self
.
log
(
'用户:'
+
self
.
name
+
' 第'
+
str
(
i
)
+
'次打卡成功,即将休眠3
0秒'
)
logger
.
info
(
'用户:'
+
self
.
name
+
' 第'
+
str
(
i
)
+
'次打卡成功,即将休眠3
0秒'
)
#self.log('用户:' + self.name + ' 第' + str(i) + '次打卡成功,即将休眠1
0秒')
self
.
log
(
'第'
+
str
(
i
)
+
'次打卡成功,即将休眠1
0秒'
)
time
.
sleep
(
10
)
self
.
dakanum
=
i
self
.
detail
()
self
.
dakaSongs
=
self
.
listenSongs
-
counter
self
.
log
(
'今日已打卡播放'
+
str
(
self
.
dakaSongs
)
+
'首'
)
if
self
.
dakaSongs
==
300
:
break
if
self
.
listenSongs
>=
20000
:
self
.
day
=
0
else
:
self
.
day
=
math
.
ceil
((
20000
-
self
.
listenSongs
)
/
300
)
self
.
list
.
append
(
"- 打卡结束,消息推送
\n\n
"
)
self
.
dakaSongs_list
=
''
.
join
(
self
.
list
)
self
.
server
()
except
:
self
.
log
(
'用户任务执行中断,请检查账号密码是否正确'
)
logger
.
error
(
'用户任务执行中断,请检查账号密码是否正确========================================'
)
else
:
self
.
log
(
'用户:'
+
self
.
name
+
' 今日任务已完成'
)
logger
.
info
(
'用户:'
+
self
.
name
+
' 今日任务已完成========================================'
)
'''
初始化:读取配置,配置文件为init.config
...
...
@@ -246,13 +263,13 @@ def taskPool():
logger
.
info
(
'多人开关已打开,即将执行进行多人任务'
)
account
=
loadJson
(
"account.json"
)
for
man
in
account
:
logger
.
info
(
'账号: '
+
man
[
'account'
]
+
' 开始执行========================================'
)
logger
.
info
(
'账号: '
+
man
[
'account'
]
+
' 开始执行
\n
========================================'
)
task
=
Task
(
man
[
'account'
],
man
[
'password'
],
man
[
'sckey'
])
task
.
start
()
time
.
sleep
(
10
)
logger
.
info
(
'所有账号已全部完成任务,服务进入休眠中,等待明天重新启动'
)
else
:
logger
.
info
(
'账号: '
+
config
[
'uin'
]
+
' 开始执行========================================'
)
logger
.
info
(
'账号: '
+
config
[
'uin'
]
+
' 开始执行
\n
========================================'
)
if
config
[
'md5Switch'
]
is
True
:
logger
.
info
(
'MD5开关已打开,即将开始为你加密,密码不会上传至服务器,请知悉'
)
config
[
'pwd'
]
=
md5
(
config
[
'pwd'
])
...
...
main.py
浏览文件 @
bdbf3bd0
#coding:utf-8
'''
@author: ZainCheung
@LastEditors:
ZainCheung
@LastEditors:
Daphel
@description:网易云音乐全自动每日打卡300首歌升级账号等级,使用前请先到init.config文件配置
@Date: 2020-06-25 14:28:48
@LastEditTime: 2020-0
6-26 17:38
:18
@LastEditTime: 2020-0
8-20 09:50
:18
'''
from
configparser
import
ConfigParser
from
threading
import
Timer
...
...
@@ -15,6 +15,7 @@ import datetime
import
time
import
json
import
logging
import
math
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
)
...
...
@@ -42,7 +43,7 @@ class Task(object):
return
response
'''
登
陆
登
录
'''
def
login
(
self
):
data
=
{
"uin"
:
self
.
uin
,
"pwd"
:
self
.
pwd
,
"r"
:
random
.
random
()}
...
...
@@ -57,10 +58,10 @@ class Task(object):
if
code
==
200
:
self
.
error
=
''
else
:
self
.
error
=
'登
陆
失败,请检查账号'
self
.
error
=
'登
录
失败,请检查账号'
self
.
cookies
=
response
.
cookies
.
get_dict
()
self
.
log
(
'登
陆
成功'
)
logging
.
info
(
"登
陆
成功"
)
self
.
log
(
'登
录
成功'
)
logging
.
info
(
"登
录
成功"
)
'''
每日签到
...
...
@@ -131,26 +132,35 @@ class Task(object):
self
.
tip
=
'还需听歌'
+
str
(
count
-
self
.
listenSongs
)
+
'首即可升级'
break
else
:
self
.
tip
=
'你已经听够20000首歌曲,如果登
陆
天数达到800天即可满级'
self
.
tip
=
'你已经听够20000首歌曲,如果登
录
天数达到800天即可满级'
else
:
self
.
tip
=
'恭喜你已经满级!'
if
self
.
error
==
''
:
state
=
'目前已完成签到,300百首歌也已听完'
self
.
title
=
'网易云听歌任务已完成'
state
=
(
"- 目前已完成签到
\n
"
"- 今日共打卡"
+
str
(
self
.
dakanum
)
+
"次
\n
"
"- 今日共播放"
+
str
(
self
.
dakaSongs
)
+
"首歌
\n
"
"- 还需要打卡"
+
str
(
self
.
day
)
+
"天"
)
self
.
title
=
(
"网易云今日打卡"
+
str
(
self
.
dakaSongs
)
+
"首,已播放"
+
str
(
self
.
listenSongs
)
+
"首"
)
else
:
state
=
self
.
error
self
.
title
=
'网易云听歌任务出现问题!'
self
.
content
=
(
"> tip:等级数据每天下午2点更新
\n\n
"
self
.
content
=
(
"------
\n
"
"
| 用户名 | "
+
str
(
self
.
name
)
+
" |
\n
"
"
| -------- | :----------------: |
\n
"
"
| 当前等级 | "
+
str
(
self
.
level
)
+
"级 |
\n
"
"
| 累计播放 | "
+
str
(
self
.
listenSongs
)
+
"首 |
\n
"
"
| 升级提示 | "
+
self
.
tip
+
" |
\n
"
"
#### 账户信息
\n
"
"
- 用户名称:"
+
str
(
self
.
name
)
+
"
\n
"
"
- 当前等级:"
+
str
(
self
.
level
)
+
"级
\n
"
"
- 累计播放:"
+
str
(
self
.
listenSongs
)
+
"首
\n
"
"
- 升级提示:"
+
self
.
tip
+
"
\n
\n
"
"------
\n
"
"### 任务状态
\n
"
+
str
(
state
)
+
"
\n\n
"
"### 考研倒计时
\n
距考研还有"
+
str
(
date
)
+
"天,主人要加油学习啊
\n
"
"### 今日一句
\n
"
+
one
+
"
\n\n
"
)
"#### 任务状态
\n
"
+
str
(
state
)
+
"
\n\n
"
"------
\n
"
"#### 注意事项
\n
- 网易云音乐等级数据每天下午2点更新
\n\n
"
"------
\n
"
"#### 打卡日志
\n
"
+
self
.
dakaSongs_list
+
"
\n\n
"
"------
\n
"
"#### 考研倒计时
\n
- 距考研还有"
+
str
(
date
)
+
"天,主人要加油学习啊!
\n\n
"
"------
\n
"
"#### 今日一句
\n
- "
+
one
+
"
\n\n
"
)
'''
打印日志
...
...
@@ -158,20 +168,42 @@ class Task(object):
def
log
(
self
,
text
):
time_stamp
=
datetime
.
datetime
.
now
()
print
(
time_stamp
.
strftime
(
'%Y.%m.%d-%H:%M:%S'
)
+
' '
+
str
(
text
))
self
.
time
=
time_stamp
.
strftime
(
'%H:%M:%S'
)
self
.
list
.
append
(
"- ["
+
self
.
time
+
"] "
+
str
(
text
)
+
"
\n\n
"
)
'''
开始执行
'''
def
start
(
self
):
try
:
self
.
list
=
[]
self
.
list
.
append
(
"- 初始化完成
\n\n
"
)
self
.
login
()
self
.
sign
()
self
.
detail
()
for
i
in
range
(
1
,
4
):
counter
=
self
.
listenSongs
self
.
list
.
append
(
"- 开始打卡
\n\n
"
)
for
i
in
range
(
1
,
10
):
self
.
daka
()
self
.
log
(
'用户:'
+
self
.
name
+
' 第'
+
str
(
i
)
+
'次打卡成功,即将休眠30秒'
)
# self.log('用户:' + self.name + ' 第' + str(i) + '次打卡成功,即将休眠30秒')
self
.
log
(
'第'
+
str
(
i
)
+
'次打卡成功'
)
logging
.
info
(
'用户:'
+
self
.
name
+
' 第'
+
str
(
i
)
+
'次打卡成功,即将休眠30秒'
)
time
.
sleep
(
30
)
time
.
sleep
(
10
)
self
.
dakanum
=
i
self
.
detail
()
self
.
dakaSongs
=
self
.
listenSongs
-
counter
self
.
log
(
'今日已打卡'
+
str
(
self
.
dakaSongs
)
+
'首'
)
if
self
.
dakaSongs
==
300
:
break
if
self
.
listenSongs
>=
20000
:
self
.
day
=
0
else
:
self
.
day
=
math
.
ceil
((
20000
-
self
.
listenSongs
)
/
300
)
self
.
list
.
append
(
"- 打卡结束
\n\n
"
)
self
.
list
.
append
(
"- 消息推送
\n\n
"
)
self
.
dakaSongs_list
=
''
.
join
(
self
.
list
)
self
.
server
()
except
:
self
.
log
(
'用户任务执行中断,请检查账号密码是否正确'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录