forked from txthinking/bypass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmitm_youtubeappadblock.tengo
49 lines (42 loc) · 1.73 KB
/
mitm_youtubeappadblock.tengo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Brook: v20220515
// Youtube: v17.18.4
text := import("text")
_ := (func(request, response) {
// Begin
if(!response){
if(text.contains(request["URL"], "googlevideo.com") && !text.contains(request["URL"], "googlevideo.com/dclk_video_ads") && !text.contains(request["URL"], "redirector") && text.contains(request["URL"], "&ctier=L") && text.contains(request["URL"], ",ctier,")){
return {
"StatusCode": 302,
"Location": text.replace(text.replace(request["URL"], "&ctier=L", "", 1), ",ctier,", "", 1)
}
}
if(text.contains(request["URL"], "googlevideo.com") && !text.contains(request["URL"], "googlevideo.com/dclk_video_ads") && !text.contains(request["URL"], "googlevideo.com/videoplayback?") && !text.contains(request["URL"], "redirector") && text.contains(request["URL"], "&oad")){
return {
"StatusCode": 503
}
}
if(text.re_match(`^https?:\/\/youtubei\.googleapis\.com\/youtubei\/v\d\/player\/ad_break`, request["URL"])){
return {
"StatusCode": 503
}
}
if(text.re_match(`^https?:\/\/(www|s)\.youtube\.com\/api\/stats\/ads`, request["URL"])){
return {
"StatusCode": 503
}
}
if(text.re_match(`^https?:\/\/(www|s)\.youtube\.com\/(pagead|ptracking)`, request["URL"])){
return {
"StatusCode": 503
}
}
if(text.re_match(`^https?:\/\/s\.youtube\.com\/api\/stats\/qoe\?adcontext`, request["URL"])){
return {
"StatusCode": 503
}
}
return request
}
return response
// End
})(request, response)