In August 2020, YouTube removed the feature of sending email notifications when a subscriber uploads a video. Many watchers, myself included, prefer email notifications to app notifications. Here are some reasons why email notifications so great:
This project aims to provide a replacement to YouTube's email notifications. Running this small program checks all your subscribers and sends emails with the links to new videos.
It uses the YouTube Data API to get a list of your subscribers and uses RSS feeds to get each channel's recent uploads. A database of videos for which an email has already been sent is kept in order to not notify about the same video twice. To send emails, the program connects to an email account through SMTP.
or
There are two methods to run this software. You may run it on bare metal, or take advantage of the Docker image published to Docker Hub.
Download the source code
git clone https://github.com/MarcelRobitaille/bbyen.git
Download packages
npm install --production
Copy the template configuration file and save it as config.json
cp config.example.json config.json
mkdir -p ~/docker/bbyen
cd ~/docker/bbyen
docker-compose.yml
from this repository to that folder
wget https://raw.githubusercontent.com/MarcelRobitaille/bbyen/master/docker-compose.yml
config.json
wget https://raw.githubusercontent.com/MarcelRobitaille/bbyen/master/config.example.json \
-O config.json
After installing the software using either the bare metal or Docker method, it is mandatory to configure certain values and to set up Google API credentials.
Populate the config.json
file
Update email.host
, email.auth
, and email.sendingContact
. These are the settings to send email over SMTP.
Change email.destination
to the email address where videos should be sent.
Optionally change timers.subscriptions
and timers.videos
to configure how often your list of subscriptions is updated and how often new videos are checked for emailed about respectively.
Set up Google API credentials
The credentials have to be made on your personal account. This is the source of your subscriptions.
Go to https://console.developers.google.com and create a new project
Go to https://console.developers.google.com/apis/credentials and create OAuth 2.0 Client credentials
Click "Create Credentials" and then "OAuth client ID"
Select "Desktop app" for "Application type"
Click "Create"
Click the download button next to the new OAuth 2.0 Client ID.
Download the credentials JSON file and save it as google-credentials.json
in the folder where you downloaded the project.
Go to https://console.developers.google.com/apis/library, search for and click "YouTube Data API v3", and enable this api.
npm start
sudo docker-compose up
On the first run, you will need to authenticate the app, tying it to your Google account (the subscriptions will come from whatever account you use):
In some instances, you may want to stop receiving notifications from a list of channels (blacklist) or only receive notifications from a list of channels (whitelist). Unfortunately, there is no way to check the notification status (bell icon set to "all", "personalized", or "none") from the API. Thus, blacklist and whitelist options were added to the configuration file.
You can use the keys blacklistedChannelIds
and whitelistedChannelIds
in the top level of config.json
.
These should be arrays of the channel IDs you want to include/exclude.
For example:
{
"email": {},
...
"blacklistedChannelIds": [ "xxx", "yyy" ],
"whitelistedChannelIds": [ "zzz" ]
}
If the key whitelistedChannelIds
is present, notifications will only be sent for those channels.
If blacklistedChannelIds
is present, any notifications that would be sent for channels are skipped.
The channel ID is usually at the end of the URL of the channel's page. However, sometimes this is not the true ID but some customized shorter and readable string. In this case, you may:
copy(window.ytInitialData.metadata.channelMetadataRenderer.externalId)
in the developer console. On the channel page, press F12, click "Console", and paste this command. The channel ID will get copied to your clipboard.This is admittedly a manual and complicated process. That is because this feature is indented for advanced users. If there is demand, I will consider a more user-friendly implementation.
Please see #6 for more information on this.
It is possible to manually set up RSS feeds for each channel you are interested in. It is a very lengthy process.
Here are some advantages of BBYEN over manually configuring RSS feeds:
Pull requests welcome.
I also accept donations, but please consider other, more worthy causes.
Building the docker image:
sudo docker build . -t marcel/bbyen
I had to use --network host
to have npm install
work correctly without timing out:
sudo docker build . -t marcel/bbyen --network host