rb2k/viddl-rb — pull request #96 by kl (2014-04-05 21:31:59+00:00)
Title: Cipher guessing

Finally got this to a somewhat ready state. With this pull request the ciphers will be parsed from the Youtube Javascript if they're not found in ciphers.yml. I have tested with the latest versions, and they work but some of the older ones don't. I'll work on this next. We can still manually add ciphers to on the repo if needed. I changed the script so it checks the ETag version of the script file and not the script file, as the file size will vary now that ciphers are dynamically guessed and added. The ciphers are added to ciphers.yml if they were guessed, and the video was successfully downloaded. To implemented this I made a callback thing that is executed when a video has finished downloading.

As for the testing I have written one test that's a unit test that extracts the cipher form a few local Youtube player scripts. I also made an integration test version that tries to guess the cipher for every player version in ciphers.yml. I have disabled this test by default as it would take a while to run/eat up a lot of bandwidth, but it can be executed from the Rakefile.