metalx1000

Retro Style FBI Most Wanted BASH Shell

Aug 7th, 2020
1,354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.82 KB | None | 0 0
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2020  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, either version 3 of the License, or
  9. #(at your option) any later version.
  10.  
  11. #This program is distributed in the hope that it will be useful,
  12. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. #GNU General Public License for more details.
  15.  
  16. #You should have received a copy of the GNU General Public License
  17. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18. ######################################################################
  19. tmp_jpg="/tmp/wanted.jpg"
  20. tmp_img="/tmp/wanted.img"
  21. tmp_info="/tmp/wanted.info"
  22.  
  23. function main(){
  24.   list="$(get_list)"
  25.   for link in $list;do
  26.     get_photo $link
  27.     get_info $link
  28.     if [[ $(find $tmp_info -type f -size +5c 2>/dev/null) ]]; then
  29.       clear
  30.       chafa $tmp_jpg > $tmp_img
  31.       print_output
  32.  
  33.       echo "Press Enter to Continue..."
  34.       read
  35.     fi
  36.   done
  37.   exit 0
  38. }
  39.  
  40. function print_output(){
  41.   paste $tmp_img $tmp_info|while read l;do
  42.   echo "$l"
  43.   sleep .05
  44. done
  45. }
  46.  
  47. function get_list(){
  48.   url="https://www.fbi.gov/wanted/topten"
  49.   wget "$url" -qO- |grep "<a href=\"$url/"|cut -d\" -f2|sort -u
  50. }
  51.  
  52. function get_info(){
  53.   url="$1"
  54.   wget -qO- "$url"|\
  55.     grep -A 55 '<h2>Aliases:</h2>'|\
  56.     tr "\n" " "|\
  57.     sed 's/<tr>/\n/g'|\
  58.     sed -e 's/<[^>]*>//g;s/.\{50\}/&\n/g' > $tmp_info
  59. }
  60.  
  61. function get_photo(){
  62.   url="$1"
  63.   img="$(wget "$url" -qO-|grep 'images/image/large'|tail -n 1|cut -d\" -f2)"
  64.   wget "$img" -qO $tmp_jpg
  65. }
  66.  
  67. main
Add Comment
Please, Sign In to add comment