Skip to content

Commit

Permalink
Merge branch 'alipphardt-master'
Browse files Browse the repository at this point in the history
* alipphardt-master:
  update version and changelog
  #476: add unit test
  Update movieParser.py
  • Loading branch information
alberanid committed Aug 13, 2023
2 parents 69770fd + cfd15da commit c65b56c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[http]

- #358: access the "actress" key with "actor"
- #467: fix movies trivia parser (courtesy of Anthony Lipphardt)

* What's new in release 2023.05.01 (1922)

Expand Down
14 changes: 1 addition & 13 deletions imdb/parser/http/movieParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,21 +1200,9 @@ class DOMHTMLTriviaParser(DOMParserBase):
_defGetRefs = True

rules = [
Rule(
key='trivia',
extractor=Path(
foreach='//div[@class="sodatext"]',
path='.//text()',
transform=transformers.strip
)
)
Rule(key="trivia", extractor=Path(foreach='//div[@class="ipc-html-content-inner-div"]', path='.//text()'))
]

def preprocess_dom(self, dom):
# Remove "link this quote" links.
preprocessors.remove(dom, '//span[@class="linksoda"]')
return dom


class DOMHTMLSoundtrackParser(DOMParserBase):
"""Parser for the "soundtrack" page of a given movie.
Expand Down
2 changes: 1 addition & 1 deletion imdb/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2023.07.01'
__version__ = '2023.08.13'
4 changes: 4 additions & 0 deletions tests/test_http_movie_trivia.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def test_movie_trivia(ia):
movie = ia.get_movie('0133093', info=['trivia'])
trivia = movie.get('trivia', [])
assert len(trivia) >= 5

0 comments on commit c65b56c

Please sign in to comment.