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 PyPi Downloads 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
  • Livestream filtering
  • Premiere 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, download this project or install the package with PyPI. Then, copy the user parameters template file to the directory where the project is saved and rename it 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 or the TOML file).

Finally, execute the qtube.py file to start the software, either by running the file directly or by using the CLI qtube in the directory where the project is saved.

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 qtube.py file. Enable this option by setting the override_json parameter to True in your JSON user parameters file. Provided command line arguments will then override what is in your JSON user parameters file. This is especially useful to manage different types of videos and put them in dedicated playlists (music playlist, gaming playlist, ect...).

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
ignore_livestreams No Determines whether currently streaming livestreams are ignored. boolean
ignore_premieres No Determines whether upcoming and live premieres are ignored. boolean
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 or the TOML 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,
"ignore_livestreams":false,
"ignore_premieres":false,
"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,
"ignore_livestreams":false,
"ignore_premieres":false,
"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,
"ignore_livestreams":false,
"ignore_premieres":false,
"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.1.1.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

QTube-2.1.1-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file qtube-2.1.1.tar.gz.

File metadata

  • Download URL: qtube-2.1.1.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.3

File hashes

Hashes for qtube-2.1.1.tar.gz
Algorithm Hash digest
SHA256 02f9280151cc4e0af96071162f7b7d3b4187e50aa086d17c305986026a45ee6c
MD5 787ebc98dbfa683abefb41560f543bea
BLAKE2b-256 cd69a69067d98a5044a67d46b78bc8d85bdac0a2709c6865ff80ed15ed0f88c3

See more details on using hashes here.

File details

Details for the file QTube-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: QTube-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.3

File hashes

Hashes for QTube-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b2a47c3c654f219b58c27138b80cc61e5e00732d3b08217699fa9402b19228b
MD5 7055a2f24899ba11c4a18d38507da1b3
BLAKE2b-256 70dbceda207930c52f25df44ae877529bccff9a4fc18801b9e5ea2445812e117

See more details on using hashes here.

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