diff -ur mythvideo/mythvideo/scripts/imdb.pl my-mythvideo/mythvideo/scripts/imdb.pl
|
old
|
new
|
|
| 115 | 115 | my $year = $2; |
| 116 | 116 | |
| 117 | 117 | # parse director |
| 118 | | my $director = parseBetween($response, ">Directed by</b>", "/a><br>"); |
| | 118 | my $director = parseBetween($response, ">Directed by</h5>", "/a><br>"); |
| 119 | 119 | $director = parseBetween($director, "/\">", "<"); |
| 120 | 120 | |
| 121 | 121 | # parse writer |
| 122 | 122 | # (Note: this takes the 'first' writer, may want to include others) |
| 123 | | my $writer = parseBetween($response, ">Writing credits</b>", "</table>"); |
| | 123 | my $writer = parseBetween($response, ">Writing credits <a href=\"/wga\">(WGA)</a></h5>", "</table>"); |
| 124 | 124 | $writer = parseBetween($writer, "/\">", "</"); |
| 125 | 125 | |
| 126 | 126 | # parse plot |
| 127 | | my $plot = parseBetween($response, ">Plot Outline:</b> ", "<br>"); |
| | 127 | my $plot = parseBetween($response, ">Plot Outline:</h5> \n", "<br>"); |
| 128 | 128 | if (!$plot) { |
| 129 | | $plot = parseBetween($response, ">Plot Summary:</b> ", "<br>"); |
| | 129 | $plot = parseBetween($response, ">Plot Summary:</h5> \n", "<br>"); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if ($plot) { |
| … |
… |
|
| 139 | 139 | $plot =~ s/$title_link_pat/$1/g; |
| 140 | 140 | |
| 141 | 141 | # plot ends at first remaining link |
| 142 | | my $plot_end = index($plot, "<a href=\""); |
| | 142 | my $plot_end = index($plot, "<a class=\"tn15more inline\" href"); |
| 143 | 143 | if ($plot_end != -1) { |
| 144 | 144 | $plot = substr($plot, 0, $plot_end); |
| 145 | 145 | } |
| … |
… |
|
| 151 | 151 | |
| 152 | 152 | # parse MPAA rating |
| 153 | 153 | my $ratingcountry = "USA"; |
| 154 | | my $movierating = parseBetween($response, ">MPAA</a>:</b> ", "<br>"); |
| | 154 | my $movierating = parseBetween($response, ">MPAA</a>:</h5> \n", "</div" ); |
| 155 | 155 | if (!$movierating) { |
| 156 | | $movierating = parseBetween($response, ">Certification:</b>", "<br>"); |
| | 156 | $movierating = parseBetween($response, ">Certification:</h5>", "</div>"); |
| 157 | 157 | $movierating = parseBetween($movierating, "certificates=$ratingcountry", |
| 158 | 158 | "/a>"); |
| 159 | 159 | $movierating = parseBetween($movierating, ">", "<"); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | # parse movie length |
| 163 | | my $runtime = parseBetween($response, ">Runtime:</b>\n", " min"); |
| | 163 | my $runtime = parseBetween($response, ">Runtime:</h5>\n", " min"); |
| 164 | 164 | |
| 165 | 165 | # parse cast |
| 166 | 166 | # Note: full cast would be from url: |
| … |
… |
|
| 168 | 168 | my @actors; |
| 169 | 169 | my $cast = ""; |
| 170 | 170 | my $count = 0; |
| 171 | | my $data = parseBetween($response, "Cast overview, first billed only:", |
| | 171 | my $data = parseBetween($response, "\(Cast overview, first billed only\)", |
| 172 | 172 | "/table>"); |
| 173 | 173 | if ($data) { |
| 174 | 174 | my $beg = "/\">"; |
| … |
… |
|
| 178 | 178 | my $actor; |
| 179 | 179 | while ($start != -1) { |
| 180 | 180 | $start += length($beg); |
| 181 | | $actor = substr($data, $start, $finish - $start); |
| | 181 | if(substr($data, $start, 1) ne '<') { |
| | 182 | $actor = substr($data, $start, $finish - $start); |
| 182 | 183 | # add to array |
| 183 | 184 | $actors[$count++] = $actor; |
| 184 | | |
| | 185 | } |
| 185 | 186 | # advance data to next movie |
| 186 | 187 | $data = substr($data, - (length($data) - $finish)); |
| 187 | 188 | $start = index($data, $beg); |
| … |
… |
|
| 194 | 195 | # parse genres |
| 195 | 196 | my $lgenres = ""; |
| 196 | 197 | $count = 0; |
| 197 | | $data = parseBetween($response, "<b class=\"ch\">Genre:</b>","<b class=\"ch\">User Comments:</b>"); |
| | 198 | $data = parseBetween($response, "<h5>Genre:</h5>","<h5>User Comments:</h5>"); |
| 198 | 199 | if ($data) { |
| 199 | 200 | my $genre_pat = qr'/Sections/Genres/(?:[a-z ]+/)*">([^<]+)<'im; |
| 200 | 201 | $lgenres = join(',', ($data =~ /$genre_pat/g)); |
| … |
… |
|
| 204 | 205 | my @countries; |
| 205 | 206 | my $lcountries = ""; |
| 206 | 207 | $count = 0; |
| 207 | | $data = parseBetween($response, "<b class=\"ch\">Country:</b>","<br>"); |
| | 208 | $data = parseBetween($response, "<h5>Country:</h5>","</div>"); |
| 208 | 209 | if ($data) { |
| 209 | 210 | my $beg = "/\">"; |
| 210 | 211 | my $end = "</a>"; |
| … |
… |
|
| 428 | 429 | # check to see if we got a results page or a movie page |
| 429 | 430 | # looking for 'add=<movieid>" target=' which only exists |
| 430 | 431 | # in a movie description page |
| 431 | | my $movienum = parseBetween($response, "add=", "\" target="); |
| | 432 | my $movienum = parseBetween($response, "add=", "\""); |
| 432 | 433 | if ($movienum) { |
| 433 | 434 | if (defined $opt_d) { printf("# redirected to movie page\n"); } |
| 434 | 435 | my $movietitle = parseBetween($response, "<title>", "</title>"); |