summaryrefslogtreecommitdiff
path: root/bin/common
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-05-16 00:49:56 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-05-16 00:49:56 +0200
commitf437dee2bec320fcbab0c0aba45a50976d565ee8 (patch)
tree5983e0f4c5784af5da8572ce9353a8ab7e3061b8 /bin/common
parent96d6a9fa2db43ca1c1cbad795355f75627c0fca7 (diff)
added user-agent generation and fixed curl command
Diffstat (limited to 'bin/common')
-rwxr-xr-xbin/common/y2feed7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/common/y2feed b/bin/common/y2feed
index 8d2f9d9..196ecb7 100755
--- a/bin/common/y2feed
+++ b/bin/common/y2feed
@@ -1,9 +1,12 @@
#!/bin/sh
-ua="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36"
+ua="$(yt-dlp --dump-user-agent)"
test -z "${url:=$1}" &&
url="$(cat /dev/stdin)"
+url="http://youtube.com/$(echo "$url" |
+ awk -F '/' '{print $NF}')"
echo "url: $url" >&2
-curl -s -H "$ua" "$url"|
+
+curl -L -s -H "$ua" "$url" |
pup 'link[title=RSS] attr{href}'