Skip to main content

Automatically add Youtube videos to a playlist.

Project description


QTube

Automatically add Youtube videos to a playlist.

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Latest Version Open Issues Closed Issues License Code style: black Code Size

AboutFeaturesHow To UseExamplesFAQContactAcknowledgmentsLicense

About

The reason for the existence of this software is Youtube's seemingly random behavior when it comes to notifying people that a new video has been published (late or missing notifications, useless notification bell, videos not appearing in the subscription tab, ...).

With this software, you can set a number of rules that determine which videos are added to a dedicated playlist, so you won't miss any new uploads!

Features

Each of these rules is based on putting some kind of constraint on video properties. Currently, the following features are available:

  • Channel name filtering
  • Title filtering
  • Description filtering
  • Tags filtering
  • Language filtering
  • Caption filtering
  • Duration filtering
  • Quality filtering
  • Upload date filtering
  • Shorts filtering
  • Duplicate checking

How to use

Before using this software, you first need to get a Youtube API key and create a web app to get a client secrets file (that should look like this). This Corey Schafer video goes through the process step by step.

Once that's done, either clone this repository or download the ZIP archive. Then, copy and rename the user parameters template file to user_params.json. Modify it so that it fits your needs (more information on how in the following table and in the examples section).

Verify that you have all of the dependencies installed (see the requirements file).

Finally, execute the run.py file to start the software.

I would recommend creating a task to execute the program regularly (like once a day).

For more versatile uses, you can also use command line arguments with the run.py file. Enable this option by setting the parameter override_json to True in your JSON user parameters file. Provided command line arguments will then override what is in your JSON user parameters file.

User-defined parameters

Parameter Optional Description Possible values
required_in_channel_name Yes Words that must be in channel names, typically channel names themselves. Videos from channels not containing any of the words of this list in their name will not be added. Any string
banned_in_channel_name Yes Words that must not be in channel names, typically channel names themselves. Videos from channels containing any of the words of this list in their name will not be added. Any string
include_extra_channels No Determines whether to include channels the user is not subscribed to. boolean
extra_channel_handles Yes Handles of additional channels to be checked. Handles are found at the end of a channel's URL: https://www.youtube.com/@*handle* Any channel handle
required_in_title Yes Words that must be in video titles. Videos with titles not containing any of the words of this list will not be added. Any string
banned_in_title Yes Words that must not be in video titles. Videos with titles containing any of the words of this list will not be added. Any string
ignore_title_emojis No Determines whether emojis are ignored in video titles. boolean
ignore_title_punctuation No Determines whether punctuation is ignored in video titles. boolean
ignore_title_case No Determines whether case is ignored in video titles. boolean
required_in_description Yes Words that must be in video descriptions. Videos with descriptions not containing any of the words of this list will not be added. Any string
banned_in_description Yes Words that must not be in video descriptions. Videos with descriptions containing any of the words of this list will not be added. Any string
required_tags Yes Tags that must be associated with the videos. Any string
banned_tags Yes Tags that must not be associated with the videos. Any string
preferred_languages Yes Languages the videos need to be in. Videos with an unspecified language will be added as a precaution. Any ISO 639-1 code
require_captions No Determines whether to add videos with no captions. boolean
caption_options Yes Caption properties such as language, track kind, audio type and accessibility parameters. See Youtube captions docs
allowed_durations Yes Minimum and maximum video durations (in minutes). Two positive integers
lowest_definition Yes Minimum definition. Videos with definitions stricly lower than this value will not be added. SD or HD
lowest_resolution Yes Minimum resolution. Videos with resolutions stricly lower than this value will not be added. Any of Youtube standard resolutions
lowest_framerate Yes Minimum framerate. Videos with framerates stricly lower than this value will not be added. Positive integer
preferred_dimensions Yes Dimension the videos need to be in. 2D, 3D or both
preferred_projections Yes Projection the videos need to be in. rectangular, 360 or both
run_frequency No Defines the duration, in days, of the timeframe considered by the software. Can be interpreted as the frequency the program should be run. daily, weekly, monthly or any positive integer
keep_shorts No Determines whether to add shorts. boolean
keep_duplicates No Determines whether to add videos that are already in the playlist. boolean
upload_playlist_ID No ID of the playlist the videos will be added to. Playlist IDs are found at the end of their URL: https://www.youtube.com/playlist?list=*playlist_ID* Playlist ID
override_json No Allow command line arguments to override user_params.json parameters. boolean
verbosity No Controls how much information is shown in the terminal. Options can be combined, so that selecting each option gives the same result as selecting all.
1: Everything is shown.
2: Nothing is shown.
3: Only information regarding function execution is shown.
4: Only information regarding credentials is shown (loading, retrieving and saving).
5: Only information regarding added videos is shown (number, channel names and video titles).

all 1 ,
none 2 ,
func 3 ,
credentials 4 ,
videos 5 .

All parameters are case-sensitive by default and if you do not want to use an optional parameter, replace its value with null or delete the entry.

For further information about each parameter, check the note associated with the release they were introduced in.

Requirements

See the requirements file.

Examples

This section presents examples of user parameters json files for concrete use-cases.

Example 1 - Every videos from subscribed channels

The following user_params.json file would add every new videos from channels you are subcribed to.

{
"required_in_channel_name": null,
"banned_in_channel_name": null,
"include_extra_channels": false,
"extra_channel_handles": null,
"required_in_title": null,
"banned_in_title": null,
"ignore_title_emojis": false,
"ignore_title_punctuation": false,
"ignore_title_case": false,
"required_in_description": null,
"banned_in_description": null,
"required_tags": null,
"banned_tags": null,
"preferred_languages": null,
"require_captions":false,
"caption_options": null,
"allowed_durations": null,
"lowest_definition": null,
"lowest_resolution": null,
"lowest_framerate": null,
"preferred_dimensions": null,
"preferred_projections": null,
"run_frequency":"daily",
"keep_shorts": true,
"keep_duplicates": false,
"upload_playlist_ID": "your_playlist_ID",
"override_json":false,
"verbosity": ["credentials","videos"]
}

Example 2 - Higher quality videos

The following user_params.json file would only add videos with good quality.

{
"required_in_channel_name": null,
"banned_in_channel_name": null,
"include_extra_channels": false,
"extra_channel_handles": null,
"required_in_title": null,
"banned_in_title": null,
"ignore_title_emojis": false,
"ignore_title_punctuation": false,
"ignore_title_case": false,
"required_in_description": null,
"banned_in_description": null,
"required_tags": null,
"banned_tags": null,
"preferred_languages": null,
"require_captions":false,
"caption_options": null,
"allowed_durations": null,
"lowest_definition": "HD",
"lowest_resolution": "1080p",
"lowest_framerate": 60,
"preferred_dimensions": ["2D"],
"preferred_projections": ["rectangular"],
"run_frequency":"daily",
"keep_shorts": true,
"keep_duplicates": false,
"upload_playlist_ID": "your_playlist_ID",
"override_json":false,
"verbosity": ["credentials","videos"]
}

Example 3 - Specific video series from a creator

The following user_params.json file would only add the $1 vs. MrBeast videos.

{
"required_in_channel_name": ["MrBeast"],
"banned_in_channel_name": null,
"include_extra_channels": false,
"extra_channel_handles": null,
"required_in_title": ["$1 vs."],
"banned_in_title": null,
"ignore_title_emojis": true,
"ignore_title_punctuation": false,
"ignore_title_case": true,
"required_in_description": null,
"banned_in_description": null,
"required_tags": null,
"banned_tags": null,
"preferred_languages": ["en"],
"require_captions": false,
"caption_options": null,
"allowed_durations": null,
"lowest_definition": "HD",
"lowest_resolution": null,
"lowest_framerate": null,
"preferred_dimensions": ["2D"],
"preferred_projections": ["rectangular"],
"run_frequency":"daily",
"keep_shorts": false,
"keep_duplicates": false,
"upload_playlist_ID": "your_playlist_ID",
"override_json":false,
"verbosity": ["credentials","videos"]
}

FAQ

There are none yet. But don't hesitate to ask by sending me an email.

Contact

You can reach me by email. Please put QTube in the subject line.

Acknowledgments

Big thanks Corey Schafer for his great tutorials, as well as for providing the OAuth snippets used in this software.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

QTube-2.0.0.tar.gz (45.8 kB view hashes)

Uploaded Source

Built Distribution

QTube-2.0.0-py3-none-any.whl (45.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page