Advertisement
Kaelygon

Untitled

Feb 3rd, 2024
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. #!/bin/bash
  2. #GENERATED BY CHAT GEE PEE TEE RUN AT OWN RISK
  3.  
  4. # Extract PDF links from the markdown file
  5. pdf_links=$(awk -F'|' '/http.*\.pdf/{print $4}' your-md-file.md)
  6.  
  7. # Iterate over each PDF link and download the file
  8. while IFS= read -r link; do
  9.     # Extract the actual URL from the Markdown link
  10.     url=$(echo "$link" | grep -oP '(?<=\().*?(?=\))')
  11.  
  12.     # Extract the filename from the URL
  13.     filename=$(echo "$url" | awk -F'/' '{print $NF}')
  14.  
  15.     # Download the PDF using wget
  16.     wget "$url" -O "$filename"
  17.  
  18.     # Add a delay to avoid overwhelming the server (adjust as needed)
  19.     sleep 1
  20. done <<< "$pdf_links"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement