Skip to content

Commit

Permalink
[Feature] Handle Douyin and Kuaishou links.
Browse files Browse the repository at this point in the history
Fixes: #15
  • Loading branch information
zhanghai committed Jan 19, 2024
1 parent e926e84 commit 3628640
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions app/src/main/java/me/zhanghai/android/untracker/BuiltinRuleList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ val BuiltinRuleList =
description = "Expand common tracking short links",
script =
"""
if ($.matches(url, 'a\\.co|amzn\\.(asia|eu|to)|b23\\.tv|dwz\\.cn|u\\.jd\\.com|t\\.cn|vm\\.tiktok\\.com|url\\.cn|xhslink\\.com')
if ($.matches(url, 'a\\.co|amzn\\.(asia|eu|to)|b23\\.tv|v\\.douyin\\.com|dwz\\.cn|u\\.jd\\.com|v\\.kuaishou\\.com|t\\.cn|vm\\.tiktok\\.com|url\\.cn|xhslink\\.com')
|| $.matches(url, 'm\\.gifshow\\.com', '/s/.+')
|| $.matches(url, 'www\\.reddit\\.com', '/r/[^/]+/s/.+')) {
const response = $.fetch(url, { redirect: 'manual' });
if ([301, 302, 303, 307, 308].includes(response.status)) {
Expand Down Expand Up @@ -133,6 +134,18 @@ val BuiltinRuleList =
"""
.trimIndent()
),
Rule(
id = "c112da1e-384e-42e2-b110-ce6d8edbfe7a",
name = "Douyin",
description = "Remove tracking for Douyin",
script =
"""
if ($.matches(url, '.+\\.(douyin|iesdouyin)\\.com')) {
return $.setEncodedQuery(url, null);
}
"""
.trimIndent()
),
Rule(
id = "926090a8-a98a-4168-b6a1-b6b801c76955",
name = "Google Search",
Expand Down Expand Up @@ -169,6 +182,18 @@ val BuiltinRuleList =
"""
.trimIndent()
),
Rule(
id = "1d0c3aae-c456-4352-972a-8b0b0f6e36c1",
name = "Kuaishou",
description = "Remove tracking for Kuaishou",
script =
"""
if ($.matches(url, '(.+\\.)?m\\.chenzhongtech\\.com|m\\.gifshow\\.com|.+\\.kuaishou\\.com')) {
return $.setEncodedQuery(url, null);
}
"""
.trimIndent()
),
Rule(
id = "465d579e-bc3b-4c5b-bac3-9b84c67c7554",
name = "Netflix",
Expand Down Expand Up @@ -234,12 +259,12 @@ val BuiltinRuleList =
name = "TikTok",
description = "Remove tracking for TikTok",
script =
"""
"""
if ($.matches(url, '.+\\.tiktok\\.com')) {
return $.setEncodedQuery(url, null);
}
"""
.trimIndent()
.trimIndent()
),
Rule(
id = "7a6a2ddb-a0a4-43fe-a97f-7cb74cd29ad5",
Expand Down

0 comments on commit 3628640

Please sign in to comment.