From b8bda0e3d54e922900597bcf591e4b0872dee3bd Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Tue, 2 Feb 2010 17:28:42 +0100 Subject: [PATCH] Google parser: fix for movies with showtime, trailer and IMDb links Fixes https://bugs.maemo.org/show_bug.cgi?id=8250. --- src/plugins/google-parser.vala | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/plugins/google-parser.vala b/src/plugins/google-parser.vala index 3eb638f..cc5a0de 100644 --- a/src/plugins/google-parser.vala +++ b/src/plugins/google-parser.vala @@ -201,7 +201,18 @@ public class GoogleParser : Object { expect_tag ("span"); // class=info string[] runtime_and_fsk = {}; double rating = 0.0; - if (parse_tag () == "nobr") { + var tag = parse_tag (); + if (tag == "a") { + // Trailer + expect_tag ("/a"); + tag = parse_tag (); + } + if (tag == "a") { + // IMDb + expect_tag ("/a"); + tag = parse_tag (); + } + if (tag == "nobr") { expect_tag ("nobr"); string rating_string = parse_tag_attribute ("img", "alt").offset (6); // "Rated " ->"0.0 out of 5.0" rating = rating_string.to_double (); @@ -212,12 +223,22 @@ public class GoogleParser : Object { expect_tag ("/nobr"); expect_tag ("/nobr"); runtime_and_fsk = parse_text ().replace ("‎", "").offset (3).split (" - "); - expect_tag ("/span"); + if (parse_tag () == "a") { + // Trailer + expect_tag ("/a"); + if (parse_tag () == "a") { + // IMDb link + expect_tag ("/a"); + expect_tag ("/span"); + } + } } expect_tag ("div"); // class=times var showtimes = parse_text ().replace (" ", ","); - expect_tag ("/div"); - expect_tag ("/div"); + while (parse_tag () == "a") { + showtimes += parse_text () + ","; + expect_tag ("/a"); + } if (pattern == null) { if (!title.has_prefix (_filter.title)) -- 1.7.9.5