File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -109,15 +109,24 @@ def is_bot_mentioned(message_text: str) -> bool:
109
109
110
110
def clean_url (message_text : str ) -> str :
111
111
"""
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 .
113
113
114
114
Args:
115
115
message_text (str): The text of the message containing the URL.
116
116
117
117
Returns:
118
118
str: The cleaned URL.
119
119
"""
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
121
130
122
131
123
132
def is_large_file (file_path : str , max_size_mb : int = 50 ) -> bool :
Original file line number Diff line number Diff line change 1
1
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
5
5
aiohttp == 3.9.3
You can’t perform that action at this time.
0 commit comments