Skip to content

Commit

Permalink
update ithome, fix toulanboy#18
Browse files Browse the repository at this point in the history
  • Loading branch information
toulanboy committed Sep 18, 2022
1 parent 00677e4 commit 1a889fa
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
5 changes: 3 additions & 2 deletions bilibili_ad/bilibili_ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ const url = $request.url;
let body = JSON.parse($response.body);

try {
if (url.indexOf('splash\/list') != -1) {

if (url.indexOf('splash\/list') != -1) { //开屏广告优化
let i = body.data.list.length;
while (i--) {
if (body.data.list[i].is_ad == true) {
Expand All @@ -48,7 +49,7 @@ try {
body.data.show[i].stime = 0;
body.data.show[i].etime = 1;
}
} else if (url.indexOf('feed\/index') != -1) {
} else if (url.indexOf('feed\/index') != -1) { //信息流优化
let i = body.data.items.length;
while (i--) {
if (body.data.items[i].card_goto.indexOf("ad") != -1 ||
Expand Down
17 changes: 17 additions & 0 deletions ithome_ad/ithome_ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ if (url.indexOf("newslist") != -1 || url.indexOf("listpage") != -1) {
body.splice(i, 1);
}
}
} else if (url.indexOf("napi") != -1) {
let listData = body.data.list;
let i = listData.length;
while (i--) {
if (listData[i].feedType == 10002) {
let j = listData[i].feedContent.focusNewsData.length;
while (j--) {
if (listData[i].feedContent.focusNewsData[j].isAd) {
listData[i].feedContent.focusNewsData.splice(j, 1);
}
}
} else if (listData[i].feedType == 10000) {
if (listData[i].feedContent.smallTags[0].text.indexOf("广告") != -1) {
listData.splice(i, 1)
}
}
}
}
body = JSON.stringify(body)
$done({
Expand Down
4 changes: 2 additions & 2 deletions ithome_ad/ithome_loon.plugin
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Script]
http-response https?:\/\/api\.ithome\.com\/json\/(((newslist|listpage)\/news)|(slide\/index)) script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/ithome_ad/ithome_ad.js,requires-body=true, tag=ithome_ad
http-response https?:\/\/(api\.ithome\.com\/json\/(((newslist|listpage)\/news)|(slide\/index)))|(napi\.ithome\.com\/api\/news\/index) script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/ithome_ad/ithome_ad.js,requires-body=true, tag=ithome_ad

[MITM]
hostname = api.ithome.com
hostname = api.ithome.com,napi.ithome.com
4 changes: 2 additions & 2 deletions ithome_ad/ithome_quan.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
hostname = api.ithome.com
hostname = api.ithome.com,napi.ithome.com

https?:\/\/api\.ithome\.com\/json\/(((newslist|listpage)\/news)|(slide\/index)) url script-response-body https://raw.githubusercontent.com/toulanboy/scripts/master/ithome_ad/ithome_ad.js
https?:\/\/(api\.ithome\.com\/json\/(((newslist|listpage)\/news)|(slide\/index)))|(napi\.ithome\.com\/api\/news\/index) url script-response-body https://raw.githubusercontent.com/toulanboy/scripts/master/ithome_ad/ithome_ad.js
4 changes: 2 additions & 2 deletions ithome_ad/ithome_surge.sgmodule
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!name=ithome_ad
#!desc=ithome_ad
[Script]
ithome_ad = type=http-response,pattern=https?:\/\/api\.ithome\.com\/json\/(((newslist|listpage)\/news)|(slide\/index)),script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/ithome_ad/ithome_ad.js,requires-body=true
ithome_ad = type=http-response,pattern=https?:\/\/(api\.ithome\.com\/json\/(((newslist|listpage)\/news)|(slide\/index)))|(napi\.ithome\.com\/api\/news\/index),script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/ithome_ad/ithome_ad.js,requires-body=true

[MITM]
hostname = %APPEND% api.ithome.com
hostname = %APPEND% api.ithome.com,napi.ithome.com

0 comments on commit 1a889fa

Please sign in to comment.