initial commit
This commit is contained in:
commit
c094b5770c
113 changed files with 6879 additions and 0 deletions
15
pkgs/yt2rss/default.nix
Normal file
15
pkgs/yt2rss/default.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
writeShellScriptBin,
|
||||
symlinkJoin,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
wrapped = writeShellScriptBin "yt2rss" (builtins.readFile ./yt2rss.sh);
|
||||
in
|
||||
symlinkJoin {
|
||||
name = "create";
|
||||
paths = [
|
||||
wrapped
|
||||
];
|
||||
}
|
||||
21
pkgs/yt2rss/yt2rss.sh
Normal file
21
pkgs/yt2rss/yt2rss.sh
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 <url>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
url=$1
|
||||
|
||||
# Check if input URL is a playlist URL
|
||||
if [[ "$url" == *"playlist"* ]]; then
|
||||
playlist_id=$(echo "$url" | grep -o 'list=[A-Za-z0-9_-]*' | cut -d'=' -f2)
|
||||
|
||||
if [ -n "$playlist_id" ]; then
|
||||
echo "https://www.youtube.com/feeds/videos.xml?playlist_id=$playlist_id"
|
||||
else
|
||||
echo "Could not extract playlist ID from URL."
|
||||
fi
|
||||
else
|
||||
curl -s "$url" | grep -o 'https://www.youtube.com/feeds/videos.xml?channel_id=[A-Za-z0-9_-]*' | sort | uniq
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue