Add subtitle-paste script for youtube subtitles. - annna - Annna the nice friendly bot.
HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
---
DIR commit bf78035f40e705cf610220abd19772985ad58f46
DIR parent d7a98c3e5f12fe4fffa83c713aec41155d3c5eb3
HTML Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Sun, 19 Apr 2020 12:13:57 +0200
Add subtitle-paste script for youtube subtitles.
Diffstat:
A subtitle-paste | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+), 0 deletions(-)
---
DIR diff --git a/subtitle-paste b/subtitle-paste
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -x
+
+export PATH="/home/annna/bin:$PATH"
+
+if [ $# -lt 1 ];
+then
+ printf "usage: %s url\n" "$(basename "$0")" >&2
+ exit 1
+fi
+
+pastebase="/br/gopher/paste"
+url="$1"
+
+cd "${pastebase}"
+tmpfile="$(mktemp -u p-XXXXXXXXXXXXX)"
+
+youtube-dl -q --write-sub --skip-download -o "${tmpfile}" "${url}"
+ofile="$(basename $(find . -name "${tmpfile}.*"))"
+if [ $(stat -c%s "${ofile}") -eq 0 ];
+then
+ rm "${ofile}"
+else
+ printf "gopher://bitreich.org/0/p/%s\n" "${ofile}"
+fi
+