clipdl


Logs | Files | LICENSE | GitLab


1
commit 414fcc72e3e5ca2d4be3eccc2d0ac232be0c997e
2
Author: Connor Etherington <[email protected]>
3
Date:   Wed Jun 1 03:56:31 2022 +0200
4
5
    Auto-Commit Update - 20220601
6
---
7
 PKGBUILD       |  2 +-
8
 usr/bin/clipdl | 50 +++++++++++++++++++++++++++++++-------------------
9
 2 files changed, 32 insertions(+), 20 deletions(-)
10
11
diff --git a/PKGBUILD b/PKGBUILD
12
index a9b2d45..3b47e2f 100644
13
--- a/PKGBUILD
14
+++ b/PKGBUILD
15
@@ -1,7 +1,7 @@
16
 # Maintainer: Connor Etherington <[email protected]>
17
 # ---
18
 pkgname=clipdl
19
-pkgver=1.2
20
+pkgver=1.3
21
 pkgrel=1
22
 pkgdesc="A simple script for downloading videos from linkss coppied to your primary clipboard"
23
 arch=(any)
24
diff --git a/usr/bin/clipdl b/usr/bin/clipdl
25
index 91fcbeb..07d4fe1 100755
26
--- a/usr/bin/clipdl
27
+++ b/usr/bin/clipdl
28
@@ -19,35 +19,46 @@ xclip -selection clipboard -o|sed 's/ /\n/g'|xargs -n1 > ${LINKS}
29
 
30
 BROWSERS=( 'brave' 'chrome' 'chromium' 'firefox' 'opera' 'vivaldi' 'safari' 'edge')
31
 
32
+
33
 withCookies(){  
34
   
35
-  ! [ -d ${dlDir} ] && mkdir -p ${dlDir} ; cd ${LOCATION:-${dlDir}}
36
-  
37
-  notify-send \
38
-    "⏬ Downloading ..." ;  notify-send \
39
-    "⏬"$(echo "$(yt-dlp --get-filename ${LINK})"|tr ' ' '_')""
40
-    yt-dlp --continue --cookies-from-browser ${BROWSER} \
41
-      --output "${LOCATION:-${downDir}/$(yt-dlp --get-filename ${LINK}|tr ' ' '_')}" ${LINK}  && 
42
+  ! [ -d ${downDir} ] && mkdir -p ${downDir}
43
+   
44
+  notify-send "⏬ Downloading ..."
45
+
46
+  NAME=$(yt-dlp --cookies-from-browser ${BROWSER} --get-filename ${LINK}|tr ' ' '_')
47
+
48
+  notify-send "⏬"${NAME}""
49
+
50
+  yt-dlp --continue --cookies-from-browser ${BROWSER} \
51
+      --output "${LOCATION:-$downDir}/${NAME}" ${LINK} && 
52
       notify-send "✅ Downloade Complete!" ||
53
-      notify-send "❌ Download Failed!" ; }
54
+      notify-send "❌ Download Failed!"  
55
+
56
+    }
57
 
58
 noCookies(){
59
   
60
-  ! [ -d ${dlDir} ] && mkdir -p ${dlDir} ; cd ${LOCATION:-${dlDir}}
61
+  ! [ -d ${downDir} ] && mkdir -p ${downDir}
62
+  
63
+  notify-send "⏬ Downloading ..."
64
 
65
-  notify-send \
66
-    "⏬ Downloading ..." ; notify-send \
67
-    "⏬"$(echo "$(yt-dlp --get-filename ${LINK})"|tr ' ' '_')""
68
-    yt-dlp --continue \
69
-      --output "${LOCATION:-${downDir}/$(yt-dlp --get-filename ${LINK}|tr ' ' '_')}" ${LINK}  && 
70
+  NAME=$(yt-dlp --get-filename ${LINK}|tr ' ' '_')
71
+
72
+  notify-send "⏬"${NAME}""
73
+    
74
+  yt-dlp --continue \
75
+      --output "${LOCATION:-$downDir}/${NAME}" ${LINK}  && 
76
       notify-send "✅ Downloade Complete!" ||
77
-      notify-send "❌ Download Failed!" ; }
78
+      notify-send "❌ Download Failed!"
79
+
80
+    }
81
 
82
 
83
 for LINK in "$(cat ${LINKS[@]})"; do
84
 
85
 
86
-siteName="$(echo "${LINKS}"|sed 's/https:\/\///;s/http:\/\///;s/www\.//;s/\/.*//')"  >/dev/null 2>&1
87
+siteName="$(echo "${LINK}"|sed 's/https:\/\///;s/http:\/\///;s/www\.//;s/\/.*//')"  >/dev/null 2>&1
88
 
89
 sitesDir="${HOME}/Media/AutoDownloads"  >/dev/null 2>&1
90
 
91
@@ -57,6 +68,8 @@ downDir="${HOME}/Media/AutoDownloads/${siteName}/Downloads"  >/dev/null 2>&1
92
 
93
 linkFile="${HOME}/Media/AutoDownloads/${siteName}/Links"  >/dev/null 2>&1
94
 
95
+
96
+
97
 case ${1} in -o|-d|--output) LOCATION="${2}" ;; esac
98
 
99
 
100
@@ -69,8 +82,8 @@ echo ${LINK}|grep -E '^https?' || continue
101
 
102
 
103
 [[ -n "${BROWSER}" ]] && for x in ${BROWSERS[@]}; do
104
-  [[ "${x}" == "${BROWSER}" ]] && withCookies
105
-done && break
106
+  [[ "${x}" == "${BROWSER}" ]] && BROWSER="${x}" && 
107
+    withCookies ; done && break
108
 
109
 for x in ${BROWSERS[@]}; do
110
   ls -1 /usr/bin | grep "${BROWSE}" >/dev/null 2>&1 && 
111
@@ -81,4 +94,3 @@ noCookies
112
 
113
 done
114
 
115
-