0

I'm on chapter 20 on The self taught Programmer: and I got an error using the import urllib.request from bs4 import beautifulsoup

import urllib.request from bs4 import BeautifulSoup

class Scraper: def init(self, site): self.site = site

def scrape(self):
    r = urllib.request\
        .urlopen(self.site)
    html = r.read()
    parser = "html.parser"
    sp = BeautifulSoup(html,
                       parser)
    for tag in sp.find_all("a"):
        url = tag.get("href")
        if url is None:
            continue
        if "html" in url:
            print("\n" + url)

news = "https://news.google.com/" Scraper(news).scrape()

error below Traceback (most recent call last): File "C:/Users/yunge/OneDrive/Desktop/SelftaughtPra/google_news.py", line 2, in from bs4 import BeautifulSoup ModuleNotFoundError: No module named 'bs4'

>

0 Answers0