diff --git a/requirements.txt b/requirements.txt index a5d53624..77ee94a2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ git+https://github.com/KurimuzonAkuma/pyrogram tgcrypto==1.2.5 -yt-dlp[default]==2024.11.04 +yt-dlp[default]==2024.11.18 APScheduler==3.10.4 beautifultable==1.1.0 ffmpeg-python==0.2.0 diff --git a/ytdlbot/utils.py b/ytdlbot/utils.py index 4ec317d4..59d5c93e 100644 --- a/ytdlbot/utils.py +++ b/ytdlbot/utils.py @@ -247,12 +247,28 @@ def parse_cookie_file(cookiefile): def extract_code_from_instagram_url(url): # Regular expression patterns - patterns = [r"/p/([a-zA-Z0-9_-]+)/", r"/reel/([a-zA-Z0-9_-]+)/"] # Posts # Reels + patterns = [ + # Instagram stories highlights + r'/stories/highlights/([a-zA-Z0-9_-]+)/', + # Posts + r"/p/([a-zA-Z0-9_-]+)/", + # Reels + r"/reel/([a-zA-Z0-9_-]+)/", + # TV + r"/tv/([a-zA-Z0-9_-]+)/", + # Threads post (both with @username and without) + r'(?:https?://)?(?:www\.)?(?:threads\.net)(?:/[@\w.]+)?(?:/post)?/([\w-]+)(?:/?\?.*)?$' + ] for pattern in patterns: match = re.search(pattern, url) if match: - return match.group(1) + if pattern == patterns[0]: # Check if it's the stories highlights pattern + # Return the URL as it is + return url + else: + # Return the code part (first group) + return match.group(1) return None