Sep-04-2023, 02:33 PM
(This post was last modified: Sep-04-2023, 02:39 PM by deanhystad.)
Looks like an internal package problem. Probably due to a change in the IMDB web page. Move on to a different package.
This fails if there is no "h4" in your soup, or if none of the h4 contain the word 'release'. I hate it when there's no "h4" released in my soup.
This fails if there is no "h4" in your soup, or if none of the h4 contain the word 'release'. I hate it when there's no "h4" released in my soup.
releases_index = [i for i in range(len(soup.select('h4'))) if 'release' in ' '.join(soup.select('h4')[i].text.split()).lower()][0]Well written web scraping code should never assume any search will find a match. And it is so easy to fix:
releases = [i for i in range(len(soup.select('h4'))) if 'release' in ' '.join(soup.select('h4')[i].text.split()).lower()] release_index = releases[0] if releases else NoneStop using the "Reply" button unless your post directly references something in the post you are replying too. Use the "New Reply" button if your post just adds information.