metalx1000

BASH Shell TV and Movie Search

Mar 21st, 2019
805
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.25 KB | None | 0 0
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2019  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.  
  20. site="https://ww2.watch-series.co"
  21.  
  22. echo -n "Search: "
  23. read q
  24.  
  25. output="$(wget -qO- "$site/search.html?keyword=$q")"
  26.  
  27. select="$(echo "$output"|grep 'href="/series/'|cut -d\" -f6|sort -u|fzf)"
  28.  
  29.   echo "$select selected"
  30.  
  31.   url="${site}$(echo "$output"|grep "$select"|head -n1|cut -d\" -f2)"
  32.   echo "${url}"
  33.   output="$(wget -qO- "${url}")"
  34.  
  35. #check if it is a movie or show
  36. season="$(basename $url)/season"
  37. echo "$output"|grep "$season" > /dev/null
  38.  
  39. o="$?"
  40.  
  41. if [ "$o" = "0" ]
  42. then
  43.   type="tv"
  44.   echo "TV Series"
  45. else
  46.   type="movie"
  47.   echo "Movie"
  48.   fi
  49.  
  50.   function download(){
  51.     l=$1
  52.     echo "Checking $l for video links..."
  53.     url="$(wget -qO- "${site}/${l}"|grep "openload.co"|cut -d\" -f6)"
  54.     if [ "$url" = "" ]
  55.     then
  56.       echo "No Openload"
  57.       #exit 1
  58.       url="$(wget -qO- "${site}/${l}"|grep "streamango.com"|cut -d\" -f6)"
  59.     fi
  60.     echo "$url"
  61.     title="$(echo "${l}"|cut -d\/ -f3).mp4"
  62.     axel -n 10 "$(youtube-dl -g "$url")" -o "$title"
  63.  
  64. }
  65.  
  66.  
  67. #####Start TV Series Section
  68. #try and download the season
  69. if [ "$type" = "tv" ]
  70. then
  71.   echo "Getting info for series"
  72.   echo "${site}/seires/$season"
  73.   wget "${site}/series/$season" -qO-|\
  74.     grep vid_info|\
  75.     cut -d\" -f4|\
  76.     tac -|\
  77.     while read l;
  78.     do
  79.       echo "===$l==="
  80.       download "$l"
  81.     done
  82. elif [ "$type" = "movie" ]
  83. then
  84.   l="series/$(basename $url)-episode-0"
  85.   download "$l"
  86. fi
Add Comment
Please, Sign In to add comment