Page 1 of 6

hulu.sh

Posted: Wed Feb 20, 2013 7:17 am
by svnpenn
This is a Bash script for downloading from Hulu

github.com/svnpenn/a/blob/98ab611/hulu.sh

In simple terms it works like this

- copy hulu cookies to temp folder (for Hulu+)
- launch Firefox with a temp profile, this prevents any changes to your normal
profile and will not disturb any existing Firefox windows
- dump Firefox process memory and search for available videos
- download selected video

If you need Bash for Windows you can try Baby Cygwin

http://code.google.com/p/any/downloads

Re: hulu.sh

Posted: Wed Feb 20, 2013 7:18 am
by svnpenn
I just need it to save with proper filename now (episode title). Still working
on that.

Re: hulu.sh

Posted: Sun Feb 24, 2013 12:58 am
by WillJ
Hey Svnpenn
I tried running this version of hulu.sh but this is what I get:

$ hulu.sh
usage: /usr/bin/hulu.sh [CDN FILETYPE] URL

CDN content delivery network
FILETYPE quality

Nothing further happens.
I am using Firefox 19, in the program files folder.
What have I done incorrectly? Your assistance would be appreciated.
Thanks

Re: hulu.sh

Posted: Sun Feb 24, 2013 1:13 am
by svnpenn
At least for right now, the URL is required. This is shown clearly with the "usage" printout.

Re: hulu.sh

Posted: Thu Mar 07, 2013 10:57 am
by svnpenn
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

Re: hulu.sh

Posted: Fri Mar 08, 2013 8:35 am
by svnpenn
Add MP4 support

If FFmpeg is found at /usr/local/bin, then remux to MP4 from FLV

github.com/svnpenn/a/commit/18e0

Re: hulu.sh

Posted: Fri Mar 08, 2013 3:20 pm
by Zeranoe
svnpenn wrote:Add MP4 support

If FFmpeg is found at /usr/local/bin, then remux to MP4 from FLV

github.com/svnpenn/a/commit/18e0
Why search only in /usr/local? Might work better to run something like:

Code: Select all

if ! type -P ffmpeg >/dev/null; then
  log ffmpeg -i "$flv.flv" -c copy -v warning "$flv.mp4"
  log rm "$flv.flv"
fi
So any FFmpeg found within the PATH will work.

Re: hulu.sh

Posted: Fri Mar 08, 2013 5:16 pm
by svnpenn
Zeranoe wrote: Why search only in /usr/local? Might work better to run something like:

Code: Select all

if ! type -P ffmpeg >/dev/null; then
  log ffmpeg -i "$flv.flv" -c copy -v warning "$flv.mp4"
  log rm "$flv.flv"
fi
Of course I did think of this, however /dev/null just makes me feel icky. I know it is strange.

Re: hulu.sh

Posted: Fri Mar 08, 2013 5:35 pm
by Zeranoe
Sending the output of type -P to /dev/null should be safe. You only care about the exit code of type -P, and not the printed output.

On a side note, lines 26-35 could be shortened to:

Code: Select all

usage ()
{
cat <<EOF
usage: $0 [CDN FILETYPE] URL

CDN       content delivery network
FILETYPE  quality

run with just URL to get CDN and FILETYPE params
EOF
exit 0
}
It also looks like you aren't using exit codes with your commands, which might be helpful to add for the users who wish to run further commands based on if your script failed/succeeded.

Lastly, you seem to be mixing in sh with bash, which should be avoided.

It's a great script though, very helpful, thanks!

Re: hulu.sh

Posted: Fri Mar 08, 2013 5:55 pm
by svnpenn
Zeranoe wrote: Lastly, you seem to be mixing in sh with bash, which should be avoided.
I assume you are talking about the process substitution?

Code: Select all

<()
Perhaps a better way is available?