- t_parameter_regex = /\"t\"\:[[:space:]]\"([^\"]+?)\"/
- matches = t_parameter_regex.match(page_data)
- t_parameter = matches[1] if not (matches.nil? || matches.length < 2)
+ t_parameter_regexes = [ /\"t\"\:[[:space:]]\"([^\"]+?)\"/,
+ /&t=([^&\"\\]+)/ ]
+ matches = t_parameter_regexes.map { |tpr| tpr.match(page_data) }
+
+ if matches.nitems == 0
+ raise StandardError.new("Could not parse the 't' parameter.")
+ end
+
+ first_match = matches.compact[0]
+ t_parameter = CGI::unescape(first_match[1])