| Hash | Commit message | Author | Date | Files | + | - |
1 | commit 85f9b07e8558ad44ce99f535ef210c0e5afe7e2f |
2 | Author: Connor Etherington <[email protected]> |
3 | Date: Wed May 18 02:34:42 2022 +0200 |
4 | |
5 | Update. |
6 | --- |
7 | PKGBUILD | 19 +++++++-------- |
8 | usr/bin/clipdl | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
9 | 2 files changed, 83 insertions(+), 9 deletions(-) |
10 | |
11 | diff --git a/PKGBUILD b/PKGBUILD |
12 | index 2f0b45b..5edda72 100644 |
13 | --- a/PKGBUILD |
14 | +++ b/PKGBUILD |
15 | @@ -1,17 +1,18 @@ |
16 | # Maintainer: Connor Etherington <[email protected]> |
17 | # --- |
18 | -pkgname= |
19 | -pkgver=1.0.1 |
20 | +pkgname=clipdl; |
21 | +pkgver=1.1 |
22 | pkgrel=1 |
23 | -pkgdesc= |
24 | -arch=() |
25 | +pkgdesc="A simple script for downloading videos from linkss coppied to your primary clipboard" |
26 | +arch=(any) |
27 | url="https://gitlab.com/a4to/${pkgname}" |
28 | license=('MIT') |
29 | -depends=() |
30 | -source=("git+.git") |
31 | +depends=(yt-dlp dunst xclip) |
32 | +source=("git+$url.git") |
33 | sha256sums=('SKIP') |
34 | |
35 | package() { |
36 | - install -Dm644 usr/share/licenses//LICENSE "/usr/share/licenses//LICENSE" |
37 | - install -Dm755 usr/bin/ |
38 | -} |
39 | + install -Dm644 usr/share/licenses/${pkgname}/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" |
40 | + install -Dm755 usr/bin/${pkgname} "${pkgdir}/usr/bin/${pkgname}" |
41 | +}[41m |
42 | [41m+ |
43 | diff --git a/usr/bin/clipdl b/usr/bin/clipdl |
44 | new file mode 100755 |
45 | index 0000000..686449b |
46 | --- /dev/null |
47 | +++ b/usr/bin/clipdl |
48 | @@ -0,0 +1,73 @@ |
49 | +#!/usr/bin/env bash |
50 | + |
51 | +## Clipboard Media Downloader |
52 | +#--- |
53 | + |
54 | +# This is a simple script to download videos from from URLs you have copied |
55 | +# from various websites. For sites where login is required, simply login in one |
56 | +# of the supported browsers before running this script. |
57 | + |
58 | +## Supported Browsers: brave, chrome, chromium, firefox, opera, vivaldi, edge, safari. |
59 | + |
60 | +## NOTE: Only the last / most recent link(s) coppied to your clipboard will be downloaded. |
61 | + |
62 | + |
63 | + |
64 | +LINKS="$(xclip -selection clipboard -o|xargs -n1)" |
65 | + |
66 | +BROWSERS=( 'brave' 'chrome' 'chromium' 'firefox' 'opera' 'vivaldi' 'safari' 'edge') |
67 | + |
68 | +withCookies(){[41m |
69 | +notify-send "⏬ Downloading: $(basename ${LINK})" ; yt-dlp \ |
70 | + --continue --cookies-from-browser "${BROWSER}" \ |
71 | + --output "${1:-${downDir}/$(basename ${LINK}|tr ' ' '_')}" \ |
72 | + ${LINK} && notify-send \ |
73 | + "✅ Downloade Complete!" || notify-send \ |
74 | + "❌ Download Failed!" ; } |
75 | + |
76 | +noCookies(){ |
77 | +notify-send "⏬ Downloading: $(basename ${LINK})" ; yt-dlp \ |
78 | + --continue --output "${1:-${downDir}/$(basename ${LINK}|tr ' ' '_')}" \ |
79 | + ${LINK} && notify-send \ |
80 | + "✅ Downloade Complete!" || notify-send \ |
81 | + "❌ Download Failed!" ; } |
82 | + |
83 | + |
84 | +for LINK in "${LINKS[@]}"; do |
85 | + |
86 | + |
87 | +siteName="$(echo "${LINKS}"|sed 's/https:\/\///;s/http:\/\///;s/www\.//;s/\/.*//')" >/dev/null 2>&1 |
88 | + |
89 | + |
90 | +sitesDir="${HOME}/Media/AutoDownloads" >/dev/null 2>&1 |
91 | + |
92 | +linkDir="${HOME}/Media/AutoDownloads/${siteName}" >/dev/null 2>&1 |
93 | + |
94 | +downDir="${HOME}/Media/AutoDownloads/${siteName}/Downloads" >/dev/null 2>&1 |
95 | + |
96 | +linkFile="${HOME}/Media/AutoDownloads/${siteName}/Links" >/dev/null 2>&1 |
97 | + |
98 | + |
99 | +echo ${LINK}|grep -E '^https?' || continue |
100 | + |
101 | + |
102 | +[[ -z "${1}" ]] && ! [ -d "${downDir}" ] && mkdir -p "${downDir}" |
103 | + |
104 | +[[ -z "${1}" ]] && echo "${LINK}" >> "${linkFile}" |
105 | + |
106 | + |
107 | +[[ -n "${BROWSER}" ]] && for x in ${BROWSERS[@]}; do |
108 | + [[ "${x}" == "${BROWSER}" ]] && withCookies |
109 | +done && break |
110 | + |
111 | +for x in ${BROWSERS[@]}; do |
112 | + ls -1 /usr/bin | grep "${BROWSE}" >/dev/null 2>&1 &&[41m |
113 | + BROWSER="${x}" && withCookies && exit 0 |
114 | +done && break |
115 | + |
116 | +noCookies |
117 | + |
118 | +done |
119 | + |
120 | + |
121 | + |