# Importing
from bs4 import BeautifulSoup
import requests 

# replace yourtargetsite/index.html with the url you want to use.
# requests.get downloads the webpage and stores it as a variable
html = requests.get('http://yourtargetsite/index.html') 

# this parses the webpage into something that beautifulsoup can read over
soup = BeautifulSoup(html.text, "lxml")
# lxml is just the parser for reading the html 

# this is the line that grabs all the links # stores all the links in the links variable
links = soup.find_all('a') 
#print (links)
for link in links:      
    # prints each link which has the atrribute 'href' 
    if "href" in (link.attrs): 
      print(link.attrs["href"])

46545bc24281bf61c06984cf90befc2184c0b556
<mask token>

<mask token>
for link in links:
    if 'href' in link.attrs:
        print(link.attrs['href'])

<mask token>
html = requests.get('http://yourtargetsite/index.html')
soup = BeautifulSoup(html.text, 'lxml')
links = soup.find_all('a')
for link in links:
    if 'href' in link.attrs:
        print(link.attrs['href'])

from bs4 import BeautifulSoup
import requests
html = requests.get('http://yourtargetsite/index.html')
soup = BeautifulSoup(html.text, 'lxml')
links = soup.find_all('a')
for link in links:
    if 'href' in link.attrs:
        print(link.attrs['href'])

# Importing
from bs4 import BeautifulSoup
import requests 

# replace yourtargetsite/index.html with the url you want to use.
# requests.get downloads the webpage and stores it as a variable
html = requests.get('http://yourtargetsite/index.html') 

# this parses the webpage into something that beautifulsoup can read over
soup = BeautifulSoup(html.text, "lxml")
# lxml is just the parser for reading the html 

# this is the line that grabs all the links # stores all the links in the links variable
links = soup.find_all('a') 
#print (links)
for link in links:      
    # prints each link which has the atrribute 'href' 
    if "href" in (link.attrs): 
      print(link.attrs["href"])
