#2 Who said that!

Merged
darmor merged 1 commits from Tsutsu/master into darmor/master 6 years ago
1 changed files with 3 additions and 4 deletions
  1. 3 4
      pastebin_scraper.sh

+ 3 - 4
pastebin_scraper.sh

@@ -8,7 +8,7 @@ Example:
 
     $0 cats
     $0 -h
-    $0 -c -dl ~/HOME/pastes/ -- cats dogs
+    $0 -c -dl ~/pastes/ -- cats dogs
 EOF
 exit 0
 }
@@ -45,9 +45,8 @@ for term in "${terms[@]}"; do
     if (( dl )); then
         echo "Downloading files please wait"
         curl -s -- "https://psbdmp.ws/api/search/$term" \
-            | jq ".data" \
-            | awk -v FS=\" '$2 == "id" {print "https://pastebin.com/raw/"$4} ' \
-            | xargs -I{} -- wget -P "$SAVE_DIR" -nc -- {}
+            | jq -r '.data[].id' \
+            | xargs -I{} -- wget -P "$SAVE_DIR" -nc -- https://pastebin.com/raw/{}
     else
         echo "Search term $term"
         echo "Total files: $(curl -s "https://psbdmp.ws/api/search/$term" | jq ".data" | wc -l)"