Automatically fetches your favorite music from your youtube music account and generates a badge from it.
virtualfuzz fe2881a236
feat: upgrade cicd
though it still doesn't work
2025-07-25 10:06:54 +02:00
.github/workflows feat: upgrade cicd 2025-07-25 10:06:54 +02:00
.commitlintrc.mjs chore: initial commit 2025-07-24 10:21:57 +02:00
.dprint.jsonc chore: initial commit 2025-07-24 10:21:57 +02:00
.gitlab-ci.yml feat: upgrade cicd 2025-07-25 10:06:54 +02:00
.pre-commit-config.yaml chore: initial commit 2025-07-24 10:21:57 +02:00
CONTRIBUTING.md chore: initial commit 2025-07-24 10:21:57 +02:00
go.mod feat: downgrade go to fix dependencies 2025-07-24 23:12:11 +02:00
go.sum feat: get favorite music from a channel 2025-07-24 15:46:13 +02:00
LICENSE.md chore: initial commit 2025-07-24 10:21:57 +02:00
nest_script.sh feat: add nest script 2025-07-25 00:05:50 +02:00
README.md docs: revert the accidentally changed readme 2025-07-25 10:04:51 +02:00
script.go fix: make it more resistant to re-runs 2025-07-25 10:03:13 +02:00

favorite music badge

Preview at https://codeberg.org/virtualfuzz

Takes your favorite music from your youtube music account and displays it into your github/codeberg/gitlab readme!!

how does this work

We automatically scrape the youtube website to get the favorite music of a specific user, this means the user has to set the channel's stats to public for that to work. Then, we generate an image link from m shields.io and we add it to the README..

Installing

This is a go application, meaning it can be installed by running

go install codeberg.org/virtualfuzz/favorite_music_badge@latest

Running

This will fetch the favorite music from a channel (please note the channel has to show its stats publicly for that to work))
favorite_music_badge CHANNEL_ID

This will automatically try to fetch the repository and will update the file with the new favorite music obtained from the channel..
favorite_music_badge -repository "REPOSITORY_URL" -filename "README.md" CHANNEL_ID

Please note that when updating, we need to find a "FAVORITE_MUSIC_BADGE_AFTER_THIS_LINE", this tells where the favorite music badge will show up in the readme, the next line after that string will be overwritten with the music badge.ge.

Fun fact: I accidentally run favorite_music_badge on the README.md of this repo and it changed it commit

CICD/automatically updating

Because this project automatically scrapes the youtube music website, youtube music isn't very happy and CICD will usually fail to scrape the website..

Because of that it is recommended to instead get your own server, and automatically run the favorite_music_badge command every day, please note that it downloads a repository inside of ./repository_to_modify so you will have to remove it before re-running the command again.in.

favorite_music_badge runs without user input if a SSH key is set and is valid, and if git is setup properly (username and email set)..

if you want to try out the gitlab cicd/github cicd anyway...

This will not work however and it will fail to scrape the youtube website.

.gitlab-ci.yml is the file for the gitlab cicd, simple change the variables inside with the proper ones and you are good to go. Also add an SSH_KEY which is a base64 encoded string of a private ssh key as a secret variable. And a GIT_BOT_EMAIL which is an email as a secret variable as well.ll.

It is the same for .github/workflows/update.yml, however this one wasn't tested and doesn't even seem to run..

License

favorite_music_badge is licensed under the AGPL-3.0-or-later.

Copyright (C) 2025 @virtualfuzz

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.on.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.s.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.