Page 2 of 6
Re: hulu.sh
Posted: Wed Mar 27, 2013 6:39 am
by kitana
Is it possible to do this (auto?) remux with the previous hulu-xp.sh you were working on? I had to manually run the below command on every FLV
Code: Select all
ffmpeg -i file.flv -vcodec copy -acodec copy file.mp4
Re: hulu.sh
Posted: Wed Mar 27, 2013 6:43 am
by svnpenn
kitana wrote:
Is it possible to do this (auto?) remux with the previous hulu-xp.sh you were working on? I had to manually run the below command on every FLV
Code: Select all
ffmpeg -i file.flv -vcodec copy -acodec copy file.mp4
Yes, with hulu-xp.sh I only changed the "coredump" function nothing more.
Re: hulu.sh
Posted: Wed Mar 27, 2013 7:07 am
by kitana
svnpenn wrote:Script now has preliminary support for episode titles.
github.com/svnpenn/a/commit/63ab
It will save in this format
Frasier 6x1 Good Grief.flv
However you will need "jq" in your /usr/local/bin
stedolan.github.com/jq
If you do not have "jq" it will be saved in this format
441362.flv
I would assume hulu-xp.sh also includes support for episodic titles?
Re: hulu.sh
Posted: Wed Mar 27, 2013 7:20 am
by svnpenn
kitana wrote:
I would assume hulu-xp.sh also includes support for episodic titles?
Yes.
Re: hulu.sh
Posted: Wed Mar 27, 2013 7:36 am
by kitana
svnpenn wrote:kitana wrote:
I would assume hulu-xp.sh also includes support for episode titles?
Yes.
Wouldn't have been possible without cygwin-25 (tried cygwin-19 earlier to no avail)
Hulu.jpg
Re: hulu.sh
Posted: Wed Mar 27, 2013 7:59 am
by svnpenn
kitana wrote:
Wouldn't have been possible without cygwin-25 (tried cygwin-19 earlier to no avail)
Ah yes, "sed" was missing until today. I never planned to use Baby Cygwin with these scripts, but I am glad it works.
Re: hulu.sh
Posted: Thu Mar 28, 2013 1:51 am
by Terminator02
I'm getting this when I try to run the script:
Since I didn't see a download from hulu.sh, I just copied all of it into a new file and named it hulu.sh, here is what's in it:
Code: Select all
#!/bin/bash
if [[ $OSTYPE =~ linux ]]
then
FIREFOX=firefox
else
FIREFOX="$PROGRAMFILES/mozilla firefox/firefox"
fi
warn ()
{
printf '\e[36m%s\e[m\n' "$*"
}
log ()
{
unset PS4
set $((set -x; : "[email protected]") 2>&1)
shift
warn $*
eval $*
}
usage ()
{
echo "usage: $0 [CDN FILETYPE] URL"
echo
echo "CDN content delivery network"
echo "FILETYPE quality"
echo
echo "run with just URL to get CDN and FILETYPE params"
exit
}
serialize_xml ()
{
set "${!1/<}"
eval set ${1/>}
for oo
do
set ${oo/=/ }
read ${1/[-:]} <<< $2
done
}
coredump ()
{
arg_pid=$!
arg_prog=$1
echo waiting for $arg_prog to load...
aaa=80
set 0 0
while sleep 1
do
mapfile bbb </proc/$arg_pid/maps
(( ccc = ${2} - ${1} ))
(( ddd = ${#bbb[*]} - ${2} ))
if (( ${ccc/-} + ${ddd/-} < aaa ))
then
break
fi
set ${2} ${#bbb[*]}
done
echo dumping $arg_prog...
read WINPID </proc/$arg_pid/winpid
dumper hulu $WINPID 2>&- &
until [ -s hulu.core ]
do
sleep 1
done
kill -13 $arg_pid
}
download ()
{
IFS=/ read gg hh <<< "$2"
exec 3< /dev/tcp/$gg/80
{
echo GET /$hh HTTP/1.1
echo connection: close
echo host: $gg
echo
} >&3
sed '1,/^$/d' <&3 > $1
}
[ $1 ] || usage
[ $3 ] || set '' '' $1
arg_cdn=$1
arg_filetype=$2
arg_url=$3
arg_pwd=$PWD
cd $WINDIR
echo ProtectedMode=0 > system32/macromed/flash/mms.cfg
rm -r /tmp
mkdir /tmp
cd "$APPDATA/mozilla/firefox"
read aa < <(find -name cookies.sqlite -exec ls -t {} +)
cp "$aa" /tmp
read aa < <(find -name prefs.js -exec ls -t {} +)
cp "$aa" /tmp
cd /tmp
MOZ_DISABLE_OOP_PLUGINS=1 "$FIREFOX" -no-remote -profile . $arg_url &
coredump firefox
grep -ao '<video [[:print:]]*>' hulu.core | sort | uniq -w123 > hulu.smil
if ! [ -s hulu.smil ]
then
warn dumped too soon, retry
echo $aaa $ccc $ddd
exit
fi
while read video
do
serialize_xml video
if ! [ $arg_cdn ]
then
printf '%-9s %9s\n' $cdn $filetype
elif [ $cdn$filetype = $arg_cdn$arg_filetype ]
then
break
else
false
fi
done < hulu.smil
[ $? = 0 ] || usage
[ $arg_cdn ] || exit
[[ $arg_url =~ [0-9]+ ]]
if [ -a /usr/local/bin/jq ]
then
download hulu.json "www.hulu.com/api/2.0/video?id=$BASH_REMATCH"
{
read uu
read vv
read ww
read xx
} < <(jq -r '.show.name, .season_number, .episode_number, .title' hulu.json)
flv="${uu} ${vv}x${ww} ${xx}"
else
flv="$BASH_REMATCH"
fi
cd "$arg_pwd"
app="${server#*//*/}?${token//amp;}"
log rtmpdump \
-W http://download.hulu.com/huludesktop.swf \
-r $server \
-a $app \
-y $stream \
-o "$flv.flv"
if [ -a /usr/local/bin/ffmpeg ]
then
log ffmpeg -i "$flv.flv" -c copy -v warning "$flv.mp4"
log rm "$flv.flv"
fi
Re: hulu.sh
Posted: Thu Mar 28, 2013 3:10 am
by svnpenn
Terminator02 wrote:I'm getting this when I try to run the script:
Since I didn't see a download from hulu.sh, I just copied all of it into a new file and named it hulu.sh, here is what's in it:
GitHub has been around for 5 years now, cmon
raw.github.com/svnpenn/a/master/hulu.sh
Re: hulu.sh
Posted: Thu Mar 28, 2013 10:30 am
by Terminator02
svnpenn wrote:Terminator02 wrote:I'm getting this when I try to run the script:
Since I didn't see a download from hulu.sh, I just copied all of it into a new file and named it hulu.sh, here is what's in it:
GitHub has been around for 5 years now, cmon
raw.github.com/svnpenn/a/master/hulu.sh
I opened that raw link before, it just opens up in my browser like so:
Therefore, I tried saving the page as "hulu.sh" and got:
Code: Select all
<!-- saved from url=(0047)https://raw.github.com/svnpenn/a/master/hulu.sh -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script type="text/javascript" src="chrome-extension://bfbmjmiodbnnpllbbbfblcplfjjepjdn/js/injected.js"></script><style type="text/css"></style></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/bin/bash
if [[ $OSTYPE =~ linux ]]
then
FIREFOX=firefox
else
FIREFOX="$PROGRAMFILES/mozilla firefox/firefox"
fi
warn ()
{
printf '\e[36m%s\e[m\n' "$*"
}
log ()
{
unset PS4
set $((set -x; : "[email protected]") 2>&1)
shift
warn $*
eval $*
}
usage ()
{
echo "usage: $0 [CDN FILETYPE] URL"
echo
echo "CDN content delivery network"
echo "FILETYPE quality"
echo
echo "run with just URL to get CDN and FILETYPE params"
exit
}
serialize_xml ()
{
set "${!1/<}"
eval set ${1/>}
for oo
do
set ${oo/=/ }
read ${1/[-:]} <<< $2
done
}
coredump ()
{
arg_pid=$!
arg_prog=$1
echo waiting for $arg_prog to load...
aaa=80
set 0 0
while sleep 1
do
mapfile bbb </proc/$arg_pid/maps
(( ccc = ${2} - ${1} ))
(( ddd = ${#bbb[*]} - ${2} ))
if (( ${ccc/-} + ${ddd/-} < aaa ))
then
break
fi
set ${2} ${#bbb[*]}
done
echo dumping $arg_prog...
read WINPID </proc/$arg_pid/winpid
dumper hulu $WINPID 2>&- &
until [ -s hulu.core ]
do
sleep 1
done
kill -13 $arg_pid
}
download ()
{
IFS=/ read gg hh <<< "$2"
exec 3< /dev/tcp/$gg/80
{
echo GET /$hh HTTP/1.1
echo connection: close
echo host: $gg
echo
} >&3
sed '1,/^$/d' <&3 > $1
}
[ $1 ] || usage
[ $3 ] || set '' '' $1
arg_cdn=$1
arg_filetype=$2
arg_url=$3
arg_pwd=$PWD
cd $WINDIR
echo ProtectedMode=0 > system32/macromed/flash/mms.cfg
rm -r /tmp
mkdir /tmp
cd "$APPDATA/mozilla/firefox"
read aa < <(find -name cookies.sqlite -exec ls -t {} +)
cp "$aa" /tmp
read aa < <(find -name prefs.js -exec ls -t {} +)
cp "$aa" /tmp
cd /tmp
MOZ_DISABLE_OOP_PLUGINS=1 "$FIREFOX" -no-remote -profile . $arg_url &
coredump firefox
grep -ao '<video [[:print:]]*>' hulu.core | sort | uniq -w123 > hulu.smil
if ! [ -s hulu.smil ]
then
warn dumped too soon, retry
echo $aaa $ccc $ddd
exit
fi
while read video
do
serialize_xml video
if ! [ $arg_cdn ]
then
printf '%-9s %9s\n' $cdn $filetype
elif [ $cdn$filetype = $arg_cdn$arg_filetype ]
then
break
else
false
fi
done < hulu.smil
[ $? = 0 ] || usage
[ $arg_cdn ] || exit
[[ $arg_url =~ [0-9]+ ]]
if [ -a /usr/local/bin/jq ]
then
download hulu.json "www.hulu.com/api/2.0/video?id=$BASH_REMATCH"
{
read uu
read vv
read ww
read xx
} < <(jq -r '.show.name, .season_number, .episode_number, .title' hulu.json)
flv="${uu} ${vv}x${ww} ${xx}"
else
flv="$BASH_REMATCH"
fi
cd "$arg_pwd"
app="${server#*//*/}?${token//amp;}"
log rtmpdump \
-W http://download.hulu.com/huludesktop.swf \
-r $server \
-a $app \
-y $stream \
-o "$flv.flv"
if [ -a /usr/local/bin/ffmpeg ]
then
log ffmpeg -i "$flv.flv" -c copy -v warning "$flv.mp4"
log rm "$flv.flv"
fi
</pre><div id="menu_item" class="jjMenuItemDiv">Copy without formatting</div><div id="sbi_camera_button" class="sbi_search" style="left: 0px; top: 0px; position: absolute; width: 29px; height: 27px; border: none; margin: 0px; padding: 0px; z-index: 2147483647; display: none;"></div></body></html>
which obviously seems to be messed up as it has HTML in it, but I went ahead and tried it anyway and got:
I then did as I had previously, trying to copy the entire text and then paste it into a "hulu.sh" file, but I get the same error:
Then I thought maybe I should try taking out the html from the downloaded file, giving me:
Code: Select all
#!/bin/bash
if [[ $OSTYPE =~ linux ]]
then
FIREFOX=firefox
else
FIREFOX="$PROGRAMFILES/mozilla firefox/firefox"
fi
warn ()
{
printf '\e[36m%s\e[m\n' "$*"
}
log ()
{
unset PS4
set $((set -x; : "[email protected]") 2>&1)
shift
warn $*
eval $*
}
usage ()
{
echo "usage: $0 [CDN FILETYPE] URL"
echo
echo "CDN content delivery network"
echo "FILETYPE quality"
echo
echo "run with just URL to get CDN and FILETYPE params"
exit
}
serialize_xml ()
{
set "${!1/<}"
eval set ${1/>}
for oo
do
set ${oo/=/ }
read ${1/[-:]} <<< $2
done
}
coredump ()
{
arg_pid=$!
arg_prog=$1
echo waiting for $arg_prog to load...
aaa=80
set 0 0
while sleep 1
do
mapfile bbb </proc/$arg_pid/maps
(( ccc = ${2} - ${1} ))
(( ddd = ${#bbb[*]} - ${2} ))
if (( ${ccc/-} + ${ddd/-} < aaa ))
then
break
fi
set ${2} ${#bbb[*]}
done
echo dumping $arg_prog...
read WINPID </proc/$arg_pid/winpid
dumper hulu $WINPID 2>&- &
until [ -s hulu.core ]
do
sleep 1
done
kill -13 $arg_pid
}
download ()
{
IFS=/ read gg hh <<< "$2"
exec 3< /dev/tcp/$gg/80
{
echo GET /$hh HTTP/1.1
echo connection: close
echo host: $gg
echo
} >&3
sed '1,/^$/d' <&3 > $1
}
[ $1 ] || usage
[ $3 ] || set '' '' $1
arg_cdn=$1
arg_filetype=$2
arg_url=$3
arg_pwd=$PWD
cd $WINDIR
echo ProtectedMode=0 > system32/macromed/flash/mms.cfg
rm -r /tmp
mkdir /tmp
cd "$APPDATA/mozilla/firefox"
read aa < <(find -name cookies.sqlite -exec ls -t {} +)
cp "$aa" /tmp
read aa < <(find -name prefs.js -exec ls -t {} +)
cp "$aa" /tmp
cd /tmp
MOZ_DISABLE_OOP_PLUGINS=1 "$FIREFOX" -no-remote -profile . $arg_url &
coredump firefox
grep -ao '<video [[:print:]]*>' hulu.core | sort | uniq -w123 > hulu.smil
if ! [ -s hulu.smil ]
then
warn dumped too soon, retry
echo $aaa $ccc $ddd
exit
fi
while read video
do
serialize_xml video
if ! [ $arg_cdn ]
then
printf '%-9s %9s\n' $cdn $filetype
elif [ $cdn$filetype = $arg_cdn$arg_filetype ]
then
break
else
false
fi
done < hulu.smil
[ $? = 0 ] || usage
[ $arg_cdn ] || exit
[[ $arg_url =~ [0-9]+ ]]
if [ -a /usr/local/bin/jq ]
then
download hulu.json "www.hulu.com/api/2.0/video?id=$BASH_REMATCH"
{
read uu
read vv
read ww
read xx
} < <(jq -r '.show.name, .season_number, .episode_number, .title' hulu.json)
flv="${uu} ${vv}x${ww} ${xx}"
else
flv="$BASH_REMATCH"
fi
cd "$arg_pwd"
app="${server#*//*/}?${token//amp;}"
log rtmpdump \
-W http://download.hulu.com/huludesktop.swf \
-r $server \
-a $app \
-y $stream \
-o "$flv.flv"
if [ -a /usr/local/bin/ffmpeg ]
then
log ffmpeg -i "$flv.flv" -c copy -v warning "$flv.mp4"
log rm "$flv.flv"
fi
But this gives me:
I must be missing something here, I'm not usually this incompetent.
Re: hulu.sh
Posted: Thu Mar 28, 2013 4:05 pm
by kitana
Terminator02 wrote:svnpenn wrote:Terminator02 wrote:I'm getting this when I try to run the script:
Since I didn't see a download from hulu.sh, I just copied all of it into a new file and named it hulu.sh, here is what's in it:
GitHub has been around for 5 years now, cmon
raw.github.com/svnpenn/a/master/hulu.sh
I must be missing something here, I'm not usually this incompetent.
Not sure if right-clicking the above link>Save link as.. would work or simply pull hulu.sh out of this ZIP
Code: Select all
https://github.com/svnpenn/a/archive/master.zip