Skip to content

Commit dbb776a

Browse files
authored
IMDb: fix website parsing
1 parent fecca39 commit dbb776a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

imdb/src/plugin.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def dictionary_init(self):
233233
self.ratingmask = re.compile('<span.*?aggregate-rating__score.*?><span.*?>(?P<rating>.*?)</span>.*?<span.*?class=.*?class=.*?>(?P<ratingcount>.*?)</div', re.S)
234234
self.castmask = re.compile('title-cast-item__actor.*?>(?P<actor>.*?)</a>(?:<div.*?<ul.*?>(?P<character>.*?)</span.*?</ul></div>)?(?:<a.*?><span><span.*?>(?P<episodes>.*?)</span></span>)?', re.S)
235235
self.postermask = re.compile('<div.*?ipc-media--poster.*?<img.*?ipc-image.*?src="(http.*?)"', re.S)
236-
self.storylinemask = re.compile('data-testid="storyline.*?<span>(?P<g_storyline>Storyline)</span>.*?ipc-html-content-inner-div.*?>(?P<storyline>.*?)</div', re.S)
236+
self.storylinemask = re.compile('<span.*?role="presentation".*?data-testid="plot-xl".*?>(?P<storyline>.*?)</span>.*?</div>.*?data-testid="storyline.*?<span>(?P<g_storyline>Storyline)</span>', re.S)
237237

238238
self.htmltags = re.compile('<.*?>', re.S)
239239
self.allhtmltags = re.compile('<.*>', re.S)
@@ -337,7 +337,7 @@ def showDetails(self):
337337
self.Page = 1
338338

339339
def showExtras(self):
340-
if self.Page == 1:
340+
if self.Page == 1 and self['key_blue'].getText():
341341
self["extralabel"].show()
342342
self["detailslabel"].hide()
343343
self["castlabel"].hide()
@@ -477,6 +477,9 @@ def html2utf8(self, in_html):
477477
def IMDBquery(self, data):
478478
self["statusbar"].setText(_("IMDb Download completed"))
479479
self.html2utf8(data)
480+
# logfile = open("/media/hdd/imdb.html", "w")
481+
# logfile.write(self.inhtml)
482+
# logfile.close()
480483
print('###############1')
481484
self.generalinfos = self.generalinfomask.search(self.inhtml)
482485
if self.generalinfos:
@@ -530,6 +533,9 @@ def http_failed(self, error):
530533
def IMDBquery2(self, data):
531534
self["statusbar"].setText(_("IMDb Re-Download completed"))
532535
self.html2utf8(data)
536+
# logfile = open("/media/hdd/imdb.html", "w")
537+
# logfile.write(self.inhtml)
538+
# logfile.close()
533539
print('###############3')
534540
self.generalinfos = self.generalinfomask.search(self.inhtml)
535541
self.IMDBparse()
@@ -721,11 +727,11 @@ def IMDBparse(self):
721727

722728
if Extratext:
723729
self["extralabel"].setText(Extratext.strip('\n'))
724-
self["extralabel"].hide()
725730
self["key_blue"].setText(_("Extra Info"))
726731
else:
727732
self["key_blue"].setText("")
728733

734+
self["extralabel"].hide()
729735
self["detailslabel"].setText(str(Detailstext))
730736

731737
def IMDBPoster(self, string):

0 commit comments

Comments
 (0)