Skip to content

Commit

Permalink
fix #225,访问链接时带上cookie,防止风控
Browse files Browse the repository at this point in the history
  • Loading branch information
nICEnnnnnnnLee committed Oct 16, 2024
1 parent 4609dbd commit bd067ef
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import nicelee.bilibili.enums.VideoQualityEnum;
import nicelee.bilibili.model.ClipInfo;
import nicelee.bilibili.model.VideoInfo;
import nicelee.bilibili.util.HttpCookies;
import nicelee.bilibili.util.HttpHeaders;
import nicelee.bilibili.util.Logger;

Expand Down Expand Up @@ -87,7 +88,7 @@ protected boolean query(int page, int min, int max, Object... obj) {

// 在第一部BV里面补全up的信息,并得到所有合集
String urlBV = "https://www.bilibili.com/video/" + firstBV;
String html = util.getContent(urlBV, new HttpHeaders().getCommonHeaders("www.bilibili.com"));
String html = util.getContent(urlBV, new HttpHeaders().getCommonHeaders("www.bilibili.com"), HttpCookies.globalCookiesWithFingerprint());
int begin = html.indexOf("window.__INITIAL_STATE__=");
int end = html.indexOf(";(function()", begin);
String result = html.substring(begin + 25, end);
Expand Down

0 comments on commit bd067ef

Please sign in to comment.