+ def unicode_unescape(string)
+ # Unescape sequences like '\u0026'.
+ # Ok, only '\u0026' for now.
+ return string.gsub('\u0026', '&')
+ end
+
+ def get_fmt_stream_list(page_data)
+ # This is another (new?) method of embedding the video URLs.
+ # The url_encoded_fmt_stream_map variable contains a list of URLs
+ # in the form url=foo1,url=foo2...
+ #
+ # It looks like the first one in the list is the highest
+ # quality? Let's just take that one for now.
+ fmt_stream_regex = /\"url_encoded_fmt_stream_map\": \"(.+?)\"/
+
+ matches = fmt_stream_regex.match(page_data)
+
+ if (matches.nil? || matches.length < 2)
+ raise StandardError.new("Could not parse the url_encoded_fmt_stream_map Flash variable.")
+ end
+
+ urlstring = matches[1]
+ urlstring.gsub!('url=', '')
+ urls = urlstring.split(',')
+ return urls
+ end
+
+