This Python script will extract all links from single web page.
Make sure that you have Beautiful Soup module installed.
When you run script, it will ask you for target domain. After that request will be fired. Beautiful Soup is used to extract links with html.parser feature.
For loop is needed to list all links using find_all() method.
import requests
from bs4 import BeautifulSoup
host = input("Page to Check: ")
req = requests.get("http://" + host)
data = req.text
real_stuff = BeautifulSoup(data, features = 'html.parser')
for x in real_stuff.find_all('a'):
print(x.get('href'))
Learn More:
Free Python Programming Course
Python Examples
Python How To
Python Modules
No comments:
Post a Comment