Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
imdby package problem
#5
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.
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 None
Stop 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.
Reply


Messages In This Thread
imdby package problem - by lunacy90 - Sep-04-2023, 12:25 PM
RE: imdby package problem - by deanhystad - Sep-04-2023, 01:54 PM
RE: imdby package problem - by lunacy90 - Sep-04-2023, 02:14 PM
RE: imdby package problem - by lunacy90 - Sep-04-2023, 02:30 PM
RE: imdby package problem - by deanhystad - Sep-04-2023, 02:33 PM
RE: imdby package problem - by lunacy90 - Sep-04-2023, 02:36 PM
RE: imdby package problem - by deanhystad - Sep-04-2023, 02:42 PM
RE: imdby package problem - by lunacy90 - Sep-04-2023, 03:45 PM
RE: imdby package problem - by deanhystad - Sep-04-2023, 07:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem install somewhere package akbarza 1 586 Dec-27-2023, 01:25 PM
Last Post: Gribouillis
  Problem: Restart kernel onPydev console when trying to install a python package poppy2020 1 7,858 Nov-25-2020, 06:13 PM
Last Post: Larz60+
  Problem with importing an installed package Reverend_Jim 4 3,821 Jun-14-2019, 10:20 PM
Last Post: Reverend_Jim
  Problem installing urlparse4 package BobLoblaw 2 5,834 Oct-06-2017, 05:16 PM
Last Post: BobLoblaw

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020