Skip to content

Commit

Permalink
[fix] update dynamic sleep time
Browse files Browse the repository at this point in the history
  • Loading branch information
runs committed May 22, 2023
1 parent 9ec2a68 commit 2ddf1af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/app/spider/update_dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (u *UpdateDynamic) spider() error {
return nil
}
for _, v := range list {
time.Sleep(200 * time.Millisecond)
time.Sleep(400 * time.Millisecond)
dynamic, err := u.sdk.Dynamic(v.DynamicID)
if err != nil {
u.logger.Error("Dynamic error", zap.Int("dynamic_id", int(v.DynamicID)), zap.Error(err))
Expand Down
10 changes: 5 additions & 5 deletions internal/pkg/bilibili/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const (
webVideoSearchURL = "https://api.bilibili.com/x/web-interface/search/type?context=&search_type=video&page=%d&order=pubdate&keyword=%s&duration=0&category_id=&tids_2=&__refresh__=true&_extra=&tids=0&highlight=1&single_column=0"
webVideoInfoURL = "https://api.bilibili.com/x/web-interface/view?bvid=%s"
webVideoTagInfoURL = "https://api.bilibili.com/x/web-interface/view/detail/tag?aid=%s"
topicHistory = "https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_history?offset_dynamic_id=%d&topic_id=%d"
dynamic = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail?dynamic_id=%d"
topicHistoryURL = "https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_history?offset_dynamic_id=%d&topic_id=%d"
dynamicURL = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail?dynamic_id=%d"
)

const (
Expand Down Expand Up @@ -269,7 +269,7 @@ type VideoInfoResponse struct {
Evaluation string `json:"evaluation"`
ArgueMsg string `json:"argue_msg"`
} `json:"stat"`
Dynamic string `json:"dynamic"`
Dynamic string `json:"dynamicURL"`
Cid int `json:"cid"`
Dimension struct {
Width int `json:"width"`
Expand Down Expand Up @@ -404,15 +404,15 @@ func (sdk *SDK) VideoWebTagInfo(aid string) (data *VideoTagResponse, err error)
}

func (sdk *SDK) TopicDynamics(topicID uint64, offsetDynamicId uint64) (data *DynamicList, err error) {
url := fmt.Sprintf(topicHistory, offsetDynamicId, topicID)
url := fmt.Sprintf(topicHistoryURL, offsetDynamicId, topicID)
if err = sdk.fastGet(url, &data); err != nil {
return nil, err
}
return data, nil
}

func (sdk *SDK) Dynamic(dynamicId uint64) (data *Dynamic, err error) {
url := fmt.Sprintf(dynamic, dynamicId)
url := fmt.Sprintf(dynamicURL, dynamicId)
if err = sdk.fastGet(url, &data); err != nil {
return nil, err
}
Expand Down

0 comments on commit 2ddf1af

Please sign in to comment.