Skip to content

Commit

Permalink
TikTok: Support more URL formats
Browse files Browse the repository at this point in the history
vt.tiktok.com
www.tiktok.com/t/
  • Loading branch information
CasualYT31 committed Dec 24, 2024
1 parent d2eecb9 commit 8aec090
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gallery_dl/extractor/tiktok.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
USER_PATTERN = BASE_PATTERN + r"/+@([\w.]{0,23}\w)?"
POST_PATTERN = USER_PATTERN + \
r"/+(?:[pP][hH][oO][tT][oO]|[vV][iI][dD][eE][oO])/+(?:[0-9]+)/*"
VM_POST_PATTERN = r"(?:https?://)?(?:vm\.)?tiktok\.com/+.*/*"
VM_POST_PATTERN = r"(?:(?:https?://)?(?:(?:vm|vt)\.)?tiktok\.com/+.*/*)|" + \
r"(?:(?:https?://)?(?:www\.)?tiktok\.com/+t/+.*/*)"


class TiktokExtractor(Extractor):
Expand Down
16 changes: 16 additions & 0 deletions test/results/tiktok.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,20 @@
"#pattern" : PATTERN,
"#options" : {"videos": False, "tiktok-range": "1-10"}
},
{
"#url" : "https://vt.tiktok.com/ZGdhVtER2",
"#comment" : "vt.tiktok.com link: single photo",
"#category" : ("", "tiktok", "vmpost"),
"#class" : tiktok.TiktokVmpostExtractor,
"#pattern" : PATTERN,
"#options" : {"videos": False}
},
{
"#url" : "https://www.tiktok.com/t/ZGdhVtER2//",
"#comment" : "www.tiktok.com/t/ link: single photo",
"#category" : ("", "tiktok", "vmpost"),
"#class" : tiktok.TiktokVmpostExtractor,
"#pattern" : PATTERN,
"#options" : {"videos": False}
},
)

0 comments on commit 8aec090

Please sign in to comment.