Skip to content

Libs version update. Remove @username from video link #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,24 @@ def is_bot_mentioned(message_text: str) -> bool:

def clean_url(message_text: str) -> str:
"""
Cleans the URL from the message text by removing unwanted characters.
Cleans the URL from the message text by removing unwanted characters and usernames.
Args:
message_text (str): The text of the message containing the URL.
Returns:
str: The cleaned URL.
"""
return message_text.replace("**", "") if message_text.startswith("**") else message_text
# Remove markdown formatting
url = message_text.replace("**", "")

# Split by space and take the first part (the URL)
url = url.split()[0]

# Remove any @username from the end of the URL
url = url.split('@')[0]

return url


def is_large_file(file_path: str, max_size_mb: int = 50) -> bool:
Expand Down
6 changes: 3 additions & 3 deletions src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
python-telegram-bot[ext]==22.0
python-dotenv==1.0.1
yt-dlp==2025.3.25
gallery-dl==1.29.2
python-dotenv==1.1.0
yt-dlp==2025.3.31
gallery-dl==1.29.4
aiohttp==3.9.3