-
Notifications
You must be signed in to change notification settings - Fork 6
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
Conversation
WalkthroughThe changes update the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant MainPy
User->>MainPy: Send message with potential markdown and username
MainPy->>MainPy: clean_url(message_text)
Note right of MainPy: Remove all '**', split by space, take first segment, remove username after '@'
MainPy-->>User: Return cleaned URL
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main.py (1)
121-121: Consider using regular expressions for more robust markdown cleaning.While the current implementation works for basic "**" removal, it might miss other markdown formatting. Consider using a regex approach if you need to handle more complex markdown in the future.
-url = message_text.replace("**", "") +# Remove various markdown formatting like **, *, __, etc. +url = re.sub(r'[\*_]{1,2}', '', message_text)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main.py(1 hunks)src/requirements.txt(1 hunks)
🔇 Additional comments (4)
src/requirements.txt (1)
2-4: Version updates look good.The dependencies have been updated to newer versions:
- python-dotenv: 1.0.1 -> 1.1.0
- yt-dlp: 2025.3.25 -> 2025.3.31
- gallery-dl: 1.29.2 -> 1.29.4
These are minor version updates that should maintain backward compatibility while providing bug fixes and new features.
src/main.py (3)
112-112: Docstring updated appropriately.The function docstring has been correctly updated to reflect the new capability of removing usernames from URLs.
120-129: Enhanced URL cleaning implementation looks good.The improved
clean_urlfunction now:
- Removes all occurrences of markdown formatting ("**")
- Extracts only the first space-separated segment as the URL
- Removes any username by splitting on '@' and taking the first part
This implementation is more robust than before and successfully addresses the PR objective to remove usernames from video links.
127-127:❓ Verification inconclusive
Edge case: Handle URLs with multiple @ symbols.
The current implementation only handles a single '@' symbol by taking everything before the first occurrence. This is fine for most cases but could potentially truncate valid URLs that contain '@' as part of their structure (e.g., some API URLs).
Consider if this is an issue for your use case. If you need to specifically target only usernames at the end of URLs, you might want to use a more targeted approach:
🏁 Script executed:
#!/bin/bash # Check if there are any examples in the codebase of URLs with @ symbols that are not usernames rg -i "https?://[^@]+@" --no-filenameLength of output: 39
Review: Potential over‑trimming of URLs with “@”
The current code
url = url.split('@')[0]will truncate everything after the first
@, which can mistakenly remove valid parts of a URL if it contains multiple@symbols (for example in user:pass@host@domain). We ran a quick search for hard‑coded URLs with@in the repo:rg -i 'https?://[^@]+@'No matches were found. Please manually verify whether any configuration files, test fixtures, or runtime inputs include URLs with embedded
@characters that should be preserved. If so, consider one of the following approaches:
- Use Python’s
urllib.parse.urlparseto strip only the user‑info segment (i.e.,ParseResult.username/.password), leaving the rest of the URL intact.- Apply a more targeted regex, for example:
import re m = re.match(r'^(https?://)(?:[^@/]+@)?(.+)$', url) url = m.group(1) + m.group(2) if m else url
Summary by CodeRabbit
Bug Fixes
Chores