1
0

pig feed system

This commit is contained in:
dtb 2022-11-02 00:00:50 -04:00
parent c20f3d08d3
commit 8ee09ede65
3 changed files with 36 additions and 0 deletions

3
rss/pig_fetch Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
curl "$1" -o -

14
rss/pig_fetch.youtube Normal file
View File

@ -0,0 +1,14 @@
#!/bin/sh
id(){
youtube-dl --skip-download --print-json --playlist-items 1 "$1" | jq '.channel_id' | tr -d '"'
}
feedurl(){
printf "https://www.youtube.com/feeds/videos.xml?channel_id=%b" "$1"
}
case "$1" in
channel) feedurl "$(id "$2")"
id) feedurl "$2"
esac | xargs curl -o - --

19
rss/pig_stow Normal file
View File

@ -0,0 +1,19 @@
#!/bin/sh
set -x
while str isvalue "$1"; do
sh pig_fetch | xq -x "$(
printf '.
+ {
pig: {
feed_url: "%b",
pet_sound: "oink",
version: "0"
}
}' "$1" \
| tr -d '[:space:]' \
)" >"$(printf "%s\n" "$1" | tr -cd "[:alnum:]")".xml
shift
done