Anonim / 2 years, 11 months ago | Download | Plaintext | Odpowiedz |

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
    def wolfram( query )
        begin
            query = CGI.escape( query )
            res = Net::HTTP.get "www01.wolframalpha.com", "/input/?i="+query
            t = []
            res.each_line{ |i| 
                m = i.match('jsonArray.popups.i_0[1234]00_1 = \{".*?": "(.*?)"' )
                if !m.nil?
                    t << m.to_a[1] if m.to_a.length > 0
                end
            }
            return t
        rescue => e

            nil
            return false
        end
    end