sheharyarn / zippy

DEPRECATED! - Zippy is a Ruby Program that downloads files from Zippyshare in your Terminal
2 stars 1 forks source link

Error :28 get_var #1

Open ghost opened 9 years ago

ghost commented 9 years ago

zippy http://www11.zippyshare.com/v/KoaO0sET/file.html

/usr/local/bin/zippy:28:in get_var': undefined methodgsub' for nil:NilClass (NoMethodError) from /usr/local/bin/zippy:47:in do_magic' from /usr/local/bin/zippy:67:inblock in

' from /usr/local/bin/zippy:66:in each' from /usr/local/bin/zippy:66:in
'

andreas--e commented 9 years ago

Yes I get the very same line 28 error using ruby 2.1.2 p95 on Linux. I could "fix" it, but then the script would be a no-op:

    def get_var(doc, var)
       regex = /var #{var} ?= ?(\d*%\d*);/
       if !doc[regex].nil?
         value = doc[regex].gsub(regex, '\1')
         eval value
       else
         puts "Error! Parsing the document returned nothing."          
       end
    end

The "bug" is that applying the regular expression regex on doc gives nothing at all, so gsub() fails because it cannot operate on a nil value. Maybe there is simply some bug in the regex, OR for some reason the document doc does not get loaded in the first place.

sheharyarn commented 9 years ago

The problem is that Zippyshare has changed their Javascript code (that makes their Download Link work) since this script was released, and from my understanding they will continue to do so (so that all scripts that allow direct downloading are rendered useless).

Re-writing the script is currently too much work for me, and I will not be doing that in the near future but I will gladly accept any Pull Requests that update the script for their new code.

andreas--e commented 9 years ago

Can you read bash? :P https://github.com/andreas--e/zippydl/blob/master/zippydl.sh Did a complete rewrite of an older (and, due to countless typos, non-working) script I found on GH.

Feel free to take this as a basis to "translate" this script to Ruby. (I don't know jack shizzle about Ruby, so you had better not count on me :P)