python – Simple Web Crawler – Code Review Stack Exchange

Hello, that's just my WebCrawler feature for small sites. I would like to know what I am doing wrong. I am grateful for all points

Import BS4 as BS
import urllib.request
of urllib.parse import urlparse, urljoin
Import pprint


Class page (object):
def __init __ (self, base_url, url):
self.url = url
self.base_url = base_url
def soup (self):
sauce = urllib.request.urlope (self.url) .read ()
return (bs.BeautifulSoup (sauce, & # 39; lxml & # 39;))
def title (self):
Soup = Auto Soup ()
Back supp.title.string
def left (self):
URLs = []
        Soup = Auto Soup ()
href = [i.get('href') for i in soup.findAll('a') ]
        left = [i for i in (list(map((lambda url : url if bool(urlparse(url).netloc) == True else urljoin (self.base_url, url)),href))) if i.startswith(self.base_url)]
        Return links
def map_page (self):
map = {self.url: {# title #: self.title (), links left #: set (self.links ())}}
Return the card

def site_map (base_url):
map_pages = {}
left_to_map = [base_url]

    def check_and_add (url):
If the URL does not exist in map_pages:
            [links_to_map.append(i) for i in Page(base_url,url).links()]
            (map_pages.update (Page (base_url, url) .map_page ()))
left_to_map.remove (url)
otherwise:
left_to_map.remove (url)

while left_to_map! = []:
url = left_to_map[0]
        check_and_add (url)

pprint.pprint (map_pages)