commit 0120eaa585071555482b194f339617057a53991b parent 6f815fc65b9f58d0054733af084d9e9dad9b45bc Author: hhvn <dev@hhvn.uk> Date: Sat, 22 Jan 2022 15:10:23 +0000 .s/y/feed .s/y/embedify: always use embed links for yt/feed Diffstat:
A | .scripts/yt/embedify | | | 6 | ++++++ |
M | .scripts/yt/feed | | | 13 | ++++--------- |
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/.scripts/yt/embedify b/.scripts/yt/embedify @@ -0,0 +1,6 @@ +#!/bin/rc + +echo $^* | sed -E ' + s~https://(www\.)?youtu\.be/([^/]*)~https://www.youtube.com/embed/\2~g + s~https://(www\.)?youtube\.com/watch\?v=([^/]*)~https://www.youtube.com/embed/\2~g +' diff --git a/.scripts/yt/feed b/.scripts/yt/feed @@ -1,10 +1,5 @@ -#!/bin/sh +#!/bin/rc -for u in $@ -do - curl -qsL $u | tr '}{,' '\n' | grep channelId | head -n 1 | sed 's/.*\\":\\"//;s/..$//' | awk '{print "https://www.youtube.com/feeds/videos.xml?channel_id=" $0}' -done | ( - [ ! -z $DISPLAY ] && { - tee /dev/stderr | xclip - } || cat -) +{for (u in $*) { + curl -qsL `$nl{yt/embedify $u} | tr '}{,' '\n' | grep channelId | head -n 1 | sed 's/.*\\":\\"//;s/..$//' | awk '{print "https://www.youtube.com/feeds/videos.xml?channel_id=" $0}' +}} | tee /dev/stderr | xclip