I am trying to extract "video" from the url and print how many there are in the console.
But I get this Error:
TypeError: 'NoneType' object is not subscriptable
Here is my code:
import requests
from bs4 import BeautifulSoup
Web_url = "https://watch.plex.tv/show/hannibal/season/1/episode/9"
r = requests.get(Web_url)
soup = BeautifulSoup(r.content, 'html.parser')
video_tags = soup.find_all("video")
print("Total", len(video_tags), "videos found")
if len(video_tags) !=0:
for video_tag in video_tags:
video_url = video_tag.find("a")['href']
print(video_url)```
source https://stackoverflow.com/questions/73913131/webscrapping-with-bs4-type-error-nonetype-object-is-not-subscriptable
Comments
Post a Comment