Guest User

Untitled

a guest
Jun 9th, 2023
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.18 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Prompt the user for the URL
  4. echo "Please enter the URL:"
  5. read url
  6.  
  7. # Download HTML page using wget
  8. wget -O page.html "$url"
  9.  
  10. # Replace href="/ with href="https://2ch.hk/ in the downloaded HTML file
  11. sed -i 's#href="/#href="https://2ch.hk/#g' page.html
  12.  
  13. # Extract links to media files (including .webp and .webm) into a separate text file
  14. grep -Eo 'href="https?://[^"]+\.(jpg|jpeg|png|gif|webp|webm|mp4)"' page.html | cut -d'"' -f2 > media_links.txt
  15.  
  16. # Function to download files with aria2
  17. download_with_aria2() {
  18.   local profile_dir=$1
  19.   local cookies=$2
  20.  
  21.   # Download files using aria2 with Firefox cookies
  22.   aria2c -x 16 --continue=true --load-cookies="$cookies" -i media_links.txt
  23. }
  24.  
  25. # Get the list of Firefox profiles
  26. profiles=$(find ~/.mozilla/firefox -maxdepth 1 -type d -name "*.*")
  27.  
  28. # Prompt the user to select a Firefox profile and get the cookies file
  29. echo "Please select a Firefox profile:"
  30. select profile_dir in $profiles; do
  31.   # Get Firefox cookies file for the selected profile
  32.   cookies=$(find "$profile_dir" -name "cookies.sqlite")
  33.   break
  34. done
  35.  
  36. # Download files using aria2 and selected cookies
  37. download_with_aria2 "$profile_dir" "$cookies"
  38.  
Add Comment
Please, Sign In to add comment