diff options
-rw-r--r-- | .SRCINFO | 14 | ||||
-rw-r--r-- | PKGBUILD | 15 | ||||
-rwxr-xr-x | reddit-video-downloader | 24 |
3 files changed, 53 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..0b5133273f9e --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,14 @@ +pkgbase = reddit-video-downloader + pkgdesc = A simple shell script that downloads reddit videos given a post url as an mp4. Only uses pure shell scripting, no python, javascript, etc. + pkgver = 1.0 + pkgrel = 1 + url = https://github.com/DapperCore/reddit-video-downloader.git + arch = any + license = MIT + depends = jq + depends = wget + depends = ffmpeg + source = reddit-video-downloader + md5sums = SKIP + +pkgname = reddit-video-downloader diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..f3083e6ebda7 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,15 @@ +# Maintainer: Dapper Core <Discord: Dapper Core#3723> +pkgname=reddit-video-downloader +pkgver=1.0 +pkgrel=1 +pkgdesc="A simple shell script that downloads reddit videos given a post url as an mp4. Only uses pure shell scripting, no python, javascript, etc." +arch=('any') +url="https://github.com/DapperCore/reddit-video-downloader.git" +license=('MIT') +depends=(jq wget ffmpeg) +source=(reddit-video-downloader) +md5sums=('SKIP') + +package() { + install -D -t "$pkgdir/usr/bin" "$srcdir/reddit-video-downloader" +}
\ No newline at end of file diff --git a/reddit-video-downloader b/reddit-video-downloader new file mode 100755 index 000000000000..779a057ba4b2 --- /dev/null +++ b/reddit-video-downloader @@ -0,0 +1,24 @@ +#!/bin/sh + +URL=$1 +TITLE=$(echo $URL| cut -d'/' -f 8) + +if [ $# = 2 ] +then + if [ -d $2 ] + then + if [ ${2: -1} = "/" ] + then + OUTPUT="${2}${TITLE}" + else + OUTPUT="${2}/${TITLE}" + fi + else + OUTPUT="${2%.*}" + fi +elif [ $# = 1 ] +then + OUTPUT=$TITLE +fi + +ffmpeg -i $(wget -qO- "https://api.reddit.com/api/info/?id=t3_$(echo $URL| cut -d'/' -f 7)" | jq -r '.data.children[0].data.secure_media.reddit_video.dash_url') -c copy "${OUTPUT}.mp4"
\ No newline at end of file |