new to beautiful soup 4, and I can't get this simple code to pick up the contents of the tags when I search something on YouTube. When I print containers, it just prints "[]" as an empty variable I assume. Any ideas why this is not picking anything up? Does this have to do with not grabbing the right tag on YouTube? In the search HTML there is the following tag for one result:
<a id="video-title" class="yt-simple-endpoint style-scope ytd-video-renderer" aria-label="Kendrick Lamar - HUMBLE. by KendrickLamarVEVO 5 months ago 3 minutes, 4 seconds 322,571,817 views" href="https://www.youtube.com/watch?v=tvTRZJ-4EyI" title="Kendrick Lamar - HUMBLE.">
Kendrick Lamar - HUMBLE.
</a>
Python code:
import bs4
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
search = "damn"
my_url = "https://www.youtube.com/results?search_query=" + search
uClient = uReq(my_url)
page_html = uClient.read()
uClient.close()
#html parsing
page_soup = soup(page_html, "html.parser")
containers = page_soup.find_all("a",{"id":"video-title"})
print(containers)
#result-count