File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 99GREEN = colorama .Fore .GREEN
1010GRAY = colorama .Fore .LIGHTBLACK_EX
1111RESET = colorama .Fore .RESET
12+ YELLOW = colorama .Fore .YELLOW
1213
1314# initialize the set of links (unique links)
1415internal_urls = set ()
@@ -62,7 +63,7 @@ def get_all_website_links(url):
6263return urls
6364
6465
65- def crawl (url , max_urls = 50 ):
66+ def crawl (url , max_urls = 30 ):
6667"""
6768 Crawls a web page and extracts all links.
6869 You'll find all links in `external_urls` and `internal_urls` global set variables.
@@ -71,6 +72,7 @@ def crawl(url, max_urls=50):
7172 """
7273global total_urls_visited
7374total_urls_visited += 1
75+ print (f"{ YELLOW } [*] Crawling: { url } { RESET } " )
7476links = get_all_website_links (url )
7577for link in links :
7678if total_urls_visited > max_urls :
@@ -93,6 +95,7 @@ def crawl(url, max_urls=50):
9395print ("[+] Total Internal links:" , len (internal_urls ))
9496print ("[+] Total External links:" , len (external_urls ))
9597print ("[+] Total URLs:" , len (external_urls ) + len (internal_urls ))
98+ print ("[+] Total crawled URLs:" , max_urls )
9699
97100domain_name = urlparse (url ).netloc
98101
Original file line number Diff line number Diff line change 99GREEN = colorama .Fore .GREEN
1010GRAY = colorama .Fore .LIGHTBLACK_EX
1111RESET = colorama .Fore .RESET
12+ YELLOW = colorama .Fore .YELLOW
1213
1314# initialize the set of links (unique links)
1415internal_urls = set ()
@@ -71,7 +72,7 @@ def get_all_website_links(url):
7172return urls
7273
7374
74- def crawl (url , max_urls = 50 ):
75+ def crawl (url , max_urls = 30 ):
7576"""
7677 Crawls a web page and extracts all links.
7778 You'll find all links in `external_urls` and `internal_urls` global set variables.
@@ -80,6 +81,7 @@ def crawl(url, max_urls=50):
8081 """
8182global total_urls_visited
8283total_urls_visited += 1
84+ print (f"{ YELLOW } [*] Crawling: { url } { RESET } " )
8385links = get_all_website_links (url )
8486for link in links :
8587if total_urls_visited > max_urls :
@@ -102,6 +104,7 @@ def crawl(url, max_urls=50):
102104print ("[+] Total Internal links:" , len (internal_urls ))
103105print ("[+] Total External links:" , len (external_urls ))
104106print ("[+] Total URLs:" , len (external_urls ) + len (internal_urls ))
107+ print ("[+] Total crawled URLs:" , max_urls )
105108
106109domain_name = urlparse (url ).netloc
107110
You can’t perform that action at this time.
0 commit comments