Scrape yt formatted strings with beautiful soup
问题 I've tried to scrape yt-formatted strings with BeautifulSoup, but it always gives me an error. Here is my code: import requests import bs4 from bs4 import BeautifulSoup r = requests.get('https://www.youtube.com/channel/UCPyMcv4yIDfETZXoJms1XFA') soup = bs4.BeautifulSoup(r.text, "html.parser") def onoroff(): onoroff = soup.find('yt-formatted-string',{'id','subscriber-count'}).text return onoroff print("Subscribers: "+str(onoroff().strip())) This is the error I get AttributeError: 'NoneType'