Skip to content

Commit

Permalink
Fix TikTok regex
Browse files Browse the repository at this point in the history
  • Loading branch information
CasualYT31 committed Dec 23, 2024
1 parent 1c12edf commit ed0bc8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gallery_dl/extractor/tiktok.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from re import compile, escape, IGNORECASE

BASE_PATTERN = r"(?:https?://)?(?:www\.)?tiktok\.com"
USER_PATTERN = BASE_PATTERN + r"/+@([\w.]{0,23}\w)(?:/\S*)?"
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/+.*/*"
Expand Down Expand Up @@ -142,7 +142,7 @@ class TiktokUserExtractor(TiktokExtractor):
"""Extract a TikTok user's profile"""

subcategory = "user"
pattern = USER_PATTERN + r"$"
pattern = USER_PATTERN + r"/*$"
example = "https://www.tiktok.com/@chillezy"

def urls(self):
Expand Down
2 changes: 1 addition & 1 deletion test/results/tiktok.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
"#options" : {"videos": True, "tiktok-range": "1-10"}
},
{
"#url" : "https://www.tiktok.com/@chillezy",
"#url" : "https://www.tiktok.com/@chillezy/",
"#comment" : "User profile without audio or videos",
"#category" : ("", "tiktok", "user"),
"#class" : tiktok.TiktokUserExtractor,
Expand Down

0 comments on commit ed0bc8a

Please sign in to comment.