Skip to content

Commit b42f098

Browse files
authored
Merge pull request #98 from ovchynnikov/dev
Libs version update. Remove @username from video link
2 parents 9055c33 + 3070d74 commit b42f098

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/main.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,24 @@ def is_bot_mentioned(message_text: str) -> bool:
109109

110110
def clean_url(message_text: str) -> str:
111111
"""
112-
Cleans the URL from the message text by removing unwanted characters.
112+
Cleans the URL from the message text by removing unwanted characters and usernames.
113113
114114
Args:
115115
message_text (str): The text of the message containing the URL.
116116
117117
Returns:
118118
str: The cleaned URL.
119119
"""
120-
return message_text.replace("**", "") if message_text.startswith("**") else message_text
120+
# Remove markdown formatting
121+
url = message_text.replace("**", "")
122+
123+
# Split by space and take the first part (the URL)
124+
url = url.split()[0]
125+
126+
# Remove any @username from the end of the URL
127+
url = url.split('@')[0]
128+
129+
return url
121130

122131

123132
def is_large_file(file_path: str, max_size_mb: int = 50) -> bool:

src/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
python-telegram-bot[ext]==22.0
2-
python-dotenv==1.0.1
3-
yt-dlp==2025.3.25
4-
gallery-dl==1.29.2
2+
python-dotenv==1.1.0
3+
yt-dlp==2025.3.31
4+
gallery-dl==1.29.4
55
aiohttp==3.9.3

0 commit comments

Comments
 (0)