Skip to content

Commit

Permalink
增加微博app签到
Browse files Browse the repository at this point in the history
  • Loading branch information
happy888888 committed Dec 23, 2020
1 parent 86260fc commit 53e0884
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 9 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@
</div>

### 💥主要功能
* [x] 💰微博超话签到⭐
* [x] 💯每日积分获取🌀
* [x] 🚅每日评论帖子并删除评论⚽
* [x] ⛄每日转发帖子并删除转发⚾
* [x] 💰微博超话签到(超话app)
* [x] 💯每日积分获取(超话app)🌀
* [x] 🚅每日评论帖子并删除评论(超话app)
* [x] ⛄每日转发帖子并删除转发(超话app)

<img src="https://user-images.githubusercontent.com/67217225/102878310-0037e600-4483-11eb-85a8-ee0ab4b496c1.png" width="500" height="600" title="任务列表" style="display:block;" />

* [x] Ⓜ微博客户端签到(微博app)☀

<img src="https://user-images.githubusercontent.com/67217225/103014306-8898b280-4579-11eb-8935-04602a8a7e9d.png" width="500" height="900" title="任务列表" style="display:block;" />

🔊📒📓📔📕📗📘📙📚📖

</br>
Expand Down
31 changes: 31 additions & 0 deletions src/WeiboClient/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,35 @@ func (w *WeiboClient) CommentsDestroy(cid string) (map[string]interface{}, error
return nil, err
}
return data, nil
}

// @title checkinSignIn
// @description 微博app签到
// @auth 星辰
// @param
// @return map[string]interface{} 接口返回值
func (w *WeiboClient) CheckinSignIn() (map[string]interface{}, error){
req, err := http.NewRequest("GET",
"https://m.weibo.cn/c/checkin/ug/v2/signin/signin?from=10AC395010&hash=task&luicode=20000301&st="+w.getST(),
nil,
)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("Referer", "https://m.weibo.cn/c/checkin")
req.Header.Set("X-Requested-With", "XMLHttpRequest")
req.Header.Set("User-Agent", "Mozilla/5.0 (Linux; Android; none; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Weibo (android)")
resp, err := w.client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
var data map[string]interface{}
err = json.Unmarshal(body, &data)
if err != nil {
return nil, err
}
return data, nil
}
57 changes: 57 additions & 0 deletions src/WeiboTask/Tasks/AppSignIn.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// @Title AppSignIn
// @Description 微博客户端签到
// @Author 星辰
// @Update
package Tasks

import (
"WeiboClient"
"fmt"
"log"
"sync"
)

// @title AppSignIn
// @description 微博客户端签到
// @auth 星辰
// @param w *WeiboClient.WeiboClient 微博客户端
// @param wg *sync.WaitGroup 等待组,保持程序同步
// @return
func AppSignIn(w *WeiboClient.WeiboClient, wg *sync.WaitGroup) {
if wg != nil {
defer wg.Done()
}
data, err := w.CheckinSignIn()
if err != nil {
log.Println("微博app签到异常:"+err.Error())
return
}
if data["ok"].(float64) != 1 {
log.Println("微博app签到错误:"+data["msg"].(string))
return
}
sign_in, ok := data["data"].(map[string]interface{})["sign_in"].(map[string]interface{})
if !ok {
log.Println("获取微博app签到信息失败")
return
}
continuous := sign_in["continuous"].(float64)
sign_in = sign_in["sign_in"].(map[string]interface{})
if sign_in["show"].(float64) == 1 {
gift := sign_in["content"].(map[string]interface{})["gift"].(map[string]interface{})
if money, ok := gift["money"]; ok {
log.Println(fmt.Sprintf("微博app签到获得%s%s,已连续签到%0.0f天",
money.(map[string]interface{})["value"].(string),
money.(map[string]interface{})["unit"].(string),
continuous))
}
if points, ok := gift["points"]; ok {
log.Println(fmt.Sprintf("微博app签到获得%s%s,已连续签到%0.0f天",
points.(map[string]interface{})["value"].(string),
points.(map[string]interface{})["unit"].(string),
continuous))
}
}else{
log.Println(fmt.Sprintf("微博app已连续签到%0.0f天", continuous))
}
}
7 changes: 3 additions & 4 deletions src/WeiboTask/Tasks/RepostAndComment.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,25 +100,24 @@ func CommentWithDel(w *WeiboClient.WeiboClient, list []string, wg *sync.WaitGrou
time.Sleep(time.Second * 6)
if err != nil {
log.Println("评论超话帖子"+mid+"异常:"+err.Error())
return
continue
}
if data["ok"].(float64) == 1 {
log.Println("评论帖子"+mid+"成功")
}else{
log.Println("评论帖子"+mid+"失败:"+data["msg"].(string))
return
continue
}
mid = data["data"].(map[string]interface{})["mid"].(string)
data, err = w.CommentsDestroy(mid)
if err != nil {
log.Println("删除帖子评论"+mid+"异常:"+err.Error())
return
continue
}
if data["ok"].(float64) == 1 {
log.Println("删除帖子评论"+mid+"成功")
}else{
log.Println("删除帖子评论"+mid+"失败:"+data["msg"].(string))
return
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/WeiboTask/runTasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import (
// @return
func runTasks(w *WeiboClient.WeiboClient) {
var mywg sync.WaitGroup
mywg.Add(3)
mywg.Add(4)
go Tasks.SuperCheckIn(w, &mywg)
go Tasks.ReceiveScore(w, &mywg)
go Tasks.RepostAndComment(w, &mywg)
go Tasks.AppSignIn(w, &mywg)
mywg.Wait()
}

0 comments on commit 53e0884

Please sign in to comment.