#!/bin/bash
#Stream movies from your shell

clip="xclip"
open="xdg-open"

if [[ "$1" == "-h" ]]
then
  echo "Query needed."
  echo "Example: $0 'bloodsport'"  
  echo "or"
  echo "Example: $0 'https://watchserieshd.co/film/freaks-and-geeks-season-1-mwp/watching.html?ep=6'"  

  exit 1
fi

q="$1"

if [[ "$q" == *"watchserieshd"* ]]
then
  url="$q"
elif [[ "$q" == "" ]]
then
  echo "checking clipboard"
  url="$($clip -o)"
else
  url="$(ddgr -w "watchserieshd.co" $q film -n 5 --json|sed 's/watching.html//g'|grep url|grep -v "html"|head -n1|cut -d" -f4)/watching.html"
fi

echo $url
url="$(wget -qO- "$url"|grep btn-eps |grep sb|cut -d" -f2,4|fzf|cut -d" -f2)"
echo ": $(date +%s):0;$0 '$url'" >> $HOME/.zsh_history
echo $url
id="$(echo $url|sed 's/embed-/|/g;s/.html//g'|cut -d| -f2)"
url="https://sbvideo.net/dl?op=download_orig&id=$id"
hash="$(wget -qO- "$url"|grep hash|cut -d" -f6)"
url="${url}&hash=${hash}"
[[ "$url" == "" ]] && ($open "$url2";exit)
echo $url
url="$(wget -qO- "$url"|grep ".mp4"|head -n1|cut -d" -f2)"

echo $url
mpv "$url"

Click Here to View on Pastebin