Advertisement
metalx1000

BASH Dump Flash Card Data from Quizlet

Jan 18th, 2025 (edited)
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.46 KB | None | 0 0
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2025  Kris Occhipinti
  4. #https://filmsbykris.com
  5.  
  6. #This program is free software: you can redistribute it and/or modify
  7. #it under the terms of the GNU General Public License as published by
  8. #the Free Software Foundation version 3 of the License.
  9.  
  10. #This program is distributed in the hope that it will be useful,
  11. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. #GNU General Public License for more details.
  14.  
  15. #You should have received a copy of the GNU General Public License
  16. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17. ######################################################################
  18.  
  19. # Dump Flashcard data from Quizlet
  20.  
  21. useragent="user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
  22.  
  23. # fatal uses SIGUSR1 to allow clean fatal errors
  24. trap "exit 1" 10
  25. PROC=$$
  26.  
  27. function error() {
  28.   red=$(echo -en "\e[31m")
  29.   normal=$(echo -en "\e[0m")
  30.  
  31.   echo -e "${red}$@${normal}" >&2
  32.   #  exit 1
  33.   kill -10 $PROC
  34. }
  35.  
  36. [[ $1 ]] || error "URL Needed"
  37. [[ $1 =~ "http" ]] || error "Invalid URL $1"
  38. url="$1"
  39.  
  40. dump="$(curl -s "$url" -H "$useragent")"
  41. echo "$dump" |
  42.   sed 's/</\n</g' |
  43.   grep "<span" |
  44.   grep TermText |
  45.   sed -e 's/<[^>]*>//g' |
  46.   recode html..ascii |
  47.   sed 'N;s/\(.*\)\n\(.*\)/\1|\2/'
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement