~ecs/ecs.d2evs.net

ref: da9b5b28311c8b31893063d2d594b9ad7e510a6e ecs.d2evs.net/proxy/youtube.sh -rw-r--r-- 621 bytes
da9b5b28Eyal Sawady Drop fediverse account 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh -eu

# Paths:
# /video?$id: youtube-dl https://youtu.be/$id onto stdout
# /search?$search: perform a search, output format:
#   => $SCRIPT_NAME/video?$id [Date] Video Author - Video Title ([Length])
# /channel?$channel: list videos from $channel in chronological order, output format:
#   => $SCRIPT_NAME/video?$id [Date] Video Title ([Length])

# TODO: playlists?

case "$PATH_INFO" in
/video)
/search)
/channel)
	[ -z "$QUERY_STRING" ] && exec printf "10 Channel name\r\n"
	tmp="$(mktemp)"
	printf "20 text/gemini\r\n"
	youtube-dl -j "ytchannel:
	rm -f "$tmp"
	;;
*)
	printf "51 Not found\r\n"
	exit
	;;
esac