I am trying to do the exercise about scraping Youtube, however soup fails in even finding all the span tags. Going through the raw HTML I dumped to file I get a count of 700+ when searching for ‘<span’, while soup only finds about a fifth of all those tags. Same with images, the only img tags soup finds are ‘<img alt’ while there are plenty of other ‘<img’ tags. What am I doing wrong?
That might happen if the HTML was not parsed correctly by the parser, and thus some of the tags may be missing in the BeautifulSoup object.
Also, be careful that the soup variable is not some old instance that contains an old document.