This script converts a YouTube channel URL to an RSS feed URL and fetches the latest videos from the channel. It can also filter videos by date or title.
- Fetch YouTube channel source code
- Extract channel ID from the source code
- Create RSS feed URL from the channel ID
- Fetch and parse RSS feed content
- Filter videos by date or title
- Copy RSS feed URL to clipboard
- Python 3.x
requests
librarybeautifulsoup4
librarylxml
library (for XML parsing)pyperclip
library
-
Clone the repository:
git clone https://github.com/yourusername/youtube_channel_to_rss.git cd youtube_channel_to_rss
-
Install the required libraries:
pip install requests beautifulsoup4 lxml pyperclip
Run the script with the YouTube channel URL as an argument. Optionally, you can filter videos by date or title.
python main.py <youtube_channel_url> [--filter_by date|title] [--filter_value <value>]
Fetch the latest videos from a YouTube channel:
python main.py https://www.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw
Fetch videos published on a specific date:
python main.py https://www.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw --filter_by date --filter_value 2023-10-01
Fetch videos with a specific keyword in the title:
python main.py https://www.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw --filter_by title --filter_value "keyword"
You can create an executable from the Python script using PyInstaller. This allows you to run the script without needing a Python interpreter.
-
Install PyInstaller:
pip install pyinstaller
-
Create the executable:
pyinstaller --onefile main.py
-
The executable will be created in the
dist
directory.
Run the executable with the YouTube channel URL as an argument. Optionally, you can filter videos by date or title.
./dist/main <youtube_channel_url> [--filter_by date|title] [--filter_value <value>]
Fetch the latest videos from a YouTube channel:
./dist/main https://www.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw
Fetch videos published on a specific date:
./dist/main https://www.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw --filter_by date --filter_value 2023-10-01
Fetch videos with a specific keyword in the title:
./dist/main https://www.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw --filter_by title --filter_value "keyword"
This project is licensed under the MIT License.