|
@@ -82,6 +82,7 @@ func parseWeiboStats(jsonData []byte) (likes, comments, reposts, reads string, e
|
|
nil
|
|
nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// GetRedBookLinkDetail 获取小红书链接数据详情
|
|
func GetRedBookLinkDetail(ctx context.Context, shareText string) (int, int, int, int, error) {
|
|
func GetRedBookLinkDetail(ctx context.Context, shareText string) (int, int, int, int, error) {
|
|
|
|
|
|
url := "http://120.46.92.62:6888/api/xhs/note_detail"
|
|
url := "http://120.46.92.62:6888/api/xhs/note_detail"
|
|
@@ -150,19 +151,36 @@ func GetRedBookLinkDetail(ctx context.Context, shareText string) (int, int, int,
|
|
return like, comment, collect, share, nil
|
|
return like, comment, collect, share, nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// GetWeiBoLinkDetail 获取微博链接数据详情
|
|
func GetWeiBoLinkDetail(ctx context.Context, shareText string) (int, int, int, int, error) {
|
|
func GetWeiBoLinkDetail(ctx context.Context, shareText string) (int, int, int, int, error) {
|
|
- url := "http://api.moreapi.cn/api/weibo/post_detail"
|
|
|
|
|
|
+ url := "http://120.46.92.62:6888/api/weibo/post_detail"
|
|
method := "POST"
|
|
method := "POST"
|
|
|
|
|
|
- payload := strings.NewReader(`{
|
|
|
|
- "id":"",
|
|
|
|
- "share_text":"",
|
|
|
|
- "proxy":""
|
|
|
|
-}`)
|
|
|
|
|
|
+ fmt.Println(shareText)
|
|
|
|
+
|
|
|
|
+ requestBody := struct {
|
|
|
|
+ Id string `json:"id"`
|
|
|
|
+ ShareText string `json:"share_text"`
|
|
|
|
+ Proxy string `json:"proxy"`
|
|
|
|
+ }{
|
|
|
|
+ Id: "",
|
|
|
|
+ ShareText: shareText,
|
|
|
|
+ Proxy: "",
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ jsonData, err := json.Marshal(requestBody)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println("JSON编码失败:", err)
|
|
|
|
+ return 0, 0, 0, 0, err
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ payload := strings.NewReader(string(jsonData))
|
|
|
|
|
|
client := &http.Client{}
|
|
client := &http.Client{}
|
|
req, err := http.NewRequest(method, url, payload)
|
|
req, err := http.NewRequest(method, url, payload)
|
|
|
|
|
|
|
|
+ fmt.Println(req)
|
|
|
|
+
|
|
if err != nil {
|
|
if err != nil {
|
|
//fmt.Println(err)
|
|
//fmt.Println(err)
|
|
return 0, 0, 0, 0, err
|
|
return 0, 0, 0, 0, err
|
|
@@ -171,14 +189,14 @@ func GetWeiBoLinkDetail(ctx context.Context, shareText string) (int, int, int, i
|
|
|
|
|
|
res, err := client.Do(req)
|
|
res, err := client.Do(req)
|
|
if err != nil {
|
|
if err != nil {
|
|
- //fmt.Println(err)
|
|
|
|
|
|
+ fmt.Println(err)
|
|
return 0, 0, 0, 0, err
|
|
return 0, 0, 0, 0, err
|
|
}
|
|
}
|
|
defer res.Body.Close()
|
|
defer res.Body.Close()
|
|
|
|
|
|
body, err := ioutil.ReadAll(res.Body)
|
|
body, err := ioutil.ReadAll(res.Body)
|
|
if err != nil {
|
|
if err != nil {
|
|
- //fmt.Println(err)
|
|
|
|
|
|
+ fmt.Println(err)
|
|
return 0, 0, 0, 0, err
|
|
return 0, 0, 0, 0, err
|
|
}
|
|
}
|
|
// fmt.Println(string(body))
|
|
// fmt.Println(string(body))
|