From b32d450d85318c348bf485c197e280646a1f3409 Mon Sep 17 00:00:00 2001 From: RXRW Date: Wed, 7 Apr 2021 14:50:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=20=E8=B6=85=E8=AF=9D=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=20=E6=97=A0=E9=99=90=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WeiboTask/Tasks/SuperCheckIn.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/WeiboTask/Tasks/SuperCheckIn.go b/src/WeiboTask/Tasks/SuperCheckIn.go index fd1096c..65dd9e5 100644 --- a/src/WeiboTask/Tasks/SuperCheckIn.go +++ b/src/WeiboTask/Tasks/SuperCheckIn.go @@ -59,7 +59,8 @@ func GetSuperTopics(w *WeiboClient.WeiboClient, ch chan<- [2]string) { break } //python里直接["data"]["cardlistInfo"]["since_id"] - sinceId, ok := data["data"].(map[string]interface{})["cardlistInfo"].(map[string]interface{})["since_id"] + var ok bool + sinceId, ok = data["data"].(map[string]interface{})["cardlistInfo"].(map[string]interface{})["since_id"].(string) if !ok { log.Println("获取超话列表sinceId错误") break From 3fc5a8438f39070b2ee24b27169c196c8283cfcf Mon Sep 17 00:00:00 2001 From: RXRW Date: Wed, 7 Apr 2021 06:57:25 +0000 Subject: [PATCH 2/2] =?UTF-8?q?fix=20f=20=E5=AF=BC=E8=87=B4=E7=9A=84=20app?= =?UTF-8?q?=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.json | 3 ++- src/WeiboClient/WeiboClient.go | 4 +++- src/WeiboClient/api.go | 24 ++++++++++++------------ src/WeiboTask/WeiboTask.go | 2 +- src/WeiboTask/config.go | 1 + 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/config.json b/config.json index 224a90b..7ec5dfe 100644 --- a/config.json +++ b/config.json @@ -14,5 +14,6 @@ } ], "C": "android", - "S": "" + "S": "", + "F": "" } \ No newline at end of file diff --git a/src/WeiboClient/WeiboClient.go b/src/WeiboClient/WeiboClient.go index 320a6be..917ee22 100644 --- a/src/WeiboClient/WeiboClient.go +++ b/src/WeiboClient/WeiboClient.go @@ -15,6 +15,7 @@ type WeiboClient struct{ client *http.Client C string S string + F string } // @title init @@ -37,10 +38,11 @@ func (w *WeiboClient) init() { // @description 创建一个WeiboClient对象并初始化 // @auth 星辰 // @return WeiboClient对象 -func New(c string, s string) *WeiboClient { +func New(c string, s string, f string) *WeiboClient { ret := new(WeiboClient) ret.init() ret.C = c ret.S = s + ret.F = f return ret } diff --git a/src/WeiboClient/api.go b/src/WeiboClient/api.go index 1a22fdc..385160c 100644 --- a/src/WeiboClient/api.go +++ b/src/WeiboClient/api.go @@ -306,7 +306,7 @@ func (w *WeiboClient) UrlSafe() (map[string]interface{}, error){ resp, err := w.client.Get("https://api.weibo.cn/2/client/url_safe"+ "?c="+w.C+ "&s="+w.S+ - "&from="+"10AC395010"+ + "&from="+w.F+ "&gsid="+w.getCookie("SUB", ".weibo.cn"), ) if err != nil { @@ -334,7 +334,7 @@ func (w *WeiboClient) CardList(containerid string) (map[string]interface{}, erro resp, err := w.client.Get("https://api.weibo.cn/2/cardlist"+ "?c="+w.C+ "&s="+w.S+ - "&from="+"10AC395010"+ + "&from="+w.F+ "&gsid="+w.getCookie("SUB", ".weibo.cn")+ "&page="+"1"+ "&count="+"20"+ @@ -369,7 +369,7 @@ func (w *WeiboClient) AppRepost(id string) (map[string]interface{}, error){ "share_source":"0", "is_fast":"1", "gsid":w.getCookie("SUB", ".weibo.cn"), - "from":"10AC395010", + "from":w.F, } var b bytes.Buffer wt := multipart.NewWriter(&b) @@ -391,7 +391,7 @@ func (w *WeiboClient) AppRepost(id string) (map[string]interface{}, error){ "?c="+w.C+ "&s="+w.S+ "&id="+id+ - "&from="+"10AC395010"+ + "&from="+w.F+ //"&gsid="+w.getCookie("SUB", ".weibo.cn"), "&gsid="+bodyMap["gsid"], &b, @@ -424,7 +424,7 @@ func (w *WeiboClient) AppDestroy(id string) (map[string]interface{}, error){ "?c="+w.C+ "&s="+w.S+ "&id="+id+ - "&from="+"10AC395010"+ + "&from="+w.F+ "&gsid="+w.getCookie("SUB", ".weibo.cn"), ) if err != nil { @@ -476,7 +476,7 @@ func (w *WeiboClient) AppCommentsCreate(id string, content string) (map[string]i "&s="+w.S+ "&fromlog="+"100016356549855"+ "&featurecode="+"10000001"+ - "&from="+"10AC395010"+ + "&from="+w.F+ "&lfid="+"guanzhu"+ "&gsid="+w.getCookie("SUB", ".weibo.cn"), &b, @@ -509,7 +509,7 @@ func (w *WeiboClient) AppCommentsDestroy(id string) (map[string]interface{}, err "?c="+w.C+ "&s="+w.S+ "&cid="+id+ - "&from="+"10AC395010"+ + "&from="+w.F+ "&gsid="+w.getCookie("SUB", ".weibo.cn"), ) if err != nil { @@ -542,7 +542,7 @@ func (w *WeiboClient) AppFriendshipsCreate(id string) (map[string]interface{}, e "&invite="+"0"+ "&able_recommend="+"0"+ "&featurecode="+"10000326"+ - "&from="+"10AC395010"+ + "&from="+w.F+ "&gsid="+w.getCookie("SUB", ".weibo.cn"), ) if err != nil { @@ -573,7 +573,7 @@ func (w *WeiboClient) AppFriendshipsDestroy(id string) (map[string]interface{}, "&uid="+id+ "&trim_level="+"0"+ "&trim="+"1"+ - "&from="+"10AC395010"+ + "&from="+w.F+ "&gsid="+w.getCookie("SUB", ".weibo.cn"), ) if err != nil { @@ -603,7 +603,7 @@ func (w *WeiboClient) AppSetLike(id string) (map[string]interface{}, error){ "&s="+w.S+ "&id="+id+ "&sourcetype="+"feed"+ - "&from="+"10AC395010"+ + "&from="+w.F+ "&gsid="+w.getCookie("SUB", ".weibo.cn"), ) if err != nil { @@ -633,7 +633,7 @@ func (w *WeiboClient) AppCancelLike(id string) (map[string]interface{}, error){ "&s="+w.S+ "&id="+id+ "&sourcetype="+"feed"+ - "&from="+"10AC395010"+ + "&from="+w.F+ "&gsid="+w.getCookie("SUB", ".weibo.cn"), ) if err != nil { @@ -665,7 +665,7 @@ func (w *WeiboClient) UnreadFriendsTimeline() (map[string]interface{}, error){ "&featurecode="+"10000001"+ "&c="+w.C+ "&s="+w.S+ - "&from="+"10AC395010"+ + "&from="+w.F+ "&lfid="+"guanzhu"+ "&gsid="+w.getCookie("SUB", ".weibo.cn"), strings.NewReader("since_id=0"), diff --git a/src/WeiboTask/WeiboTask.go b/src/WeiboTask/WeiboTask.go index d081e13..ad8278d 100644 --- a/src/WeiboTask/WeiboTask.go +++ b/src/WeiboTask/WeiboTask.go @@ -83,7 +83,7 @@ func runOnce(reloadConfig bool) { } } defer sendToServerChan() - wb := WeiboClient.New(MyConfig.C, MyConfig.S) + wb := WeiboClient.New(MyConfig.C, MyConfig.S, MyConfig.F) if wb.LoginByCookies(MyConfig.Cookies) { defer func() { MyConfig.Cookies = wb.GetCookies(); _ = SaveConfig() }() runTasks(wb) diff --git a/src/WeiboTask/config.go b/src/WeiboTask/config.go index 81900d6..8139e55 100644 --- a/src/WeiboTask/config.go +++ b/src/WeiboTask/config.go @@ -20,6 +20,7 @@ type Config struct{ Stime [2]int //定时启动时间,格式为{小时, 分钟} C string //平台,如"android" S string //app秘钥,6位字符串 + F string //app from参数,8位字符串 } var MyConfig Config //配置文件对象