Skip to content

Commit

Permalink
balh: 阿B改了什么JB代码?
Browse files Browse the repository at this point in the history
  • Loading branch information
ipcjs committed Jul 9, 2021
1 parent 80ca32a commit 80b10a4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/unblock-area-limit/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function scriptContent() {
.then(r => {
container.readyState = 4
container.response = r
container.responseText = typeof r === 'string' ? r : JSON.stringify(r)
container.__onreadystatechange(event) // 直接调用会不会存在this指向错误的问题? => 目前没看到, 先这样(;¬_¬)
})
.catch(e => {
Expand Down Expand Up @@ -205,7 +206,7 @@ function scriptContent() {
&& !Strings.getSearchParam(target.responseURL, 'balh_ajax')) {
log('/pgc/player/web/playurl', 'origin', `block: ${container.__block_response}`, target.response)
if (!container.__redirect) { // 请求没有被重定向, 则需要检测结果是否有区域限制
let json = target.response
let json = typeof target.response === 'object' ? target.response : JSON.parse(target.responseText)
if (balh_config.blocked_vip || json.code || isAreaLimitForPlayUrl(json.result)) {
areaLimit(true)
container.__block_response = true
Expand Down
2 changes: 1 addition & 1 deletion packages/unblock-area-limit/src/main.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name 解除B站区域限制
// @namespace http://tampermonkey.net/
// @version 8.2.2
// @version 8.2.3
// @description 通过替换获取视频地址接口的方式, 实现解除B站区域限制; 只对HTML5播放器生效;
// @author ipcjs
// @supportURL https://github.com/ipcjs/bilibili-helper/blob/user.js/packages/unblock-area-limit/README.md
Expand Down
5 changes: 3 additions & 2 deletions scripts/bilibili_bangumi_area_limit_hack.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name 解除B站区域限制
// @namespace http://tampermonkey.net/
// @version 8.2.2
// @version 8.2.3
// @description 通过替换获取视频地址接口的方式, 实现解除B站区域限制; 只对HTML5播放器生效;
// @author ipcjs
// @supportURL https://github.com/ipcjs/bilibili-helper/blob/user.js/packages/unblock-area-limit/README.md
Expand Down Expand Up @@ -2920,6 +2920,7 @@ function scriptSource(invokeBy) {
.then(r => {
container.readyState = 4;
container.response = r;
container.responseText = typeof r === 'string' ? r : JSON.stringify(r);
container.__onreadystatechange(event); // 直接调用会不会存在this指向错误的问题? => 目前没看到, 先这样(;¬_¬)
})
.catch(e => {
Expand Down Expand Up @@ -3065,7 +3066,7 @@ function scriptSource(invokeBy) {
&& !Strings.getSearchParam(target.responseURL, 'balh_ajax')) {
log('/pgc/player/web/playurl', 'origin', `block: ${container.__block_response}`, target.response);
if (!container.__redirect) { // 请求没有被重定向, 则需要检测结果是否有区域限制
let json = target.response;
let json = typeof target.response === 'object' ? target.response : JSON.parse(target.responseText);
if (balh_config.blocked_vip || json.code || isAreaLimitForPlayUrl(json.result)) {
areaLimit(true);
container.__block_response = true;
Expand Down

0 comments on commit 80b10a4

Please sign in to comment.