I am trying to use this code for scraping:
from bs4 import BeautifulSoup
open_url = urllib.request.urlopen('https://en.wikipedia.org/wiki/Guitar')
guitars = open_url.read()
soup = BeautifulSoup(guitars, 'html.parser')
soup
I am getting a result in HTML that includes the following line:
<div class="vector-sitenotice-container">
<div id="siteNotice"><!-- CentralNotice --></div>
</div>
<input class="mw-checkbox-hack-checkbox" id="vector-toc-collapsed-checkbox" type="checkbox"/>
But when I analyze the website, I see the following elements:
As you can see, the style element is missing and the <div dir = "ltr" id="w112021">
is missing. This includes de <a></a>
element inside.
Why isn“t the code returning these elements?