itsmehemant7 / PyMovieDb

A Simple IMDb API for Python
MIT License
90 stars 18 forks source link

Popular movie issue #9

Closed DorDDI closed 1 year ago

DorDDI commented 1 year ago

hey man, when i run the movie popular func i sometimes (like when i use Genre = 'Comedy') i got an error when there is no year in the IMDB web. In line 343 in the imdb.py file, when you update the year: "year = year.find('span', containing='(')[0] if bool(year.find('span', containing='(')) else "" " when the year isn't display it get the value of "". therefore when you got to the next line - "year = "".join(re.findall(r"\d+", year.text))" the code fail. i change the else "" to: else "TBD" or whatever value you want to add. and then added an if condition that test if year != "TBD" (there was a value in the find func before) then, it will run the "year = "".join(re.findall(r"\d+", year.text))" line and then its run smoothly. i would like to know your thoughts about it.

something like this: year = year.find('span', containing='(')[0] if bool(year.find('span', containing='(')) else "TBD" if year != "TBD": year = "".join(re.findall(r"\d+", year.text))

itsmehemant7 commented 1 year ago

resolved @DorDDI