2015-05-17 11:49:35 +02:00
|
|
|
import requests
|
2014-04-21 15:55:09 +02:00
|
|
|
import re
|
|
|
|
|
|
|
|
# get url
|
2015-05-17 11:49:35 +02:00
|
|
|
url = input('Enter a URL (include `http://`): ')
|
2014-04-21 15:55:09 +02:00
|
|
|
|
|
|
|
# connect to the url
|
2015-05-17 11:49:35 +02:00
|
|
|
website = requests.get(url)
|
2014-04-21 15:55:09 +02:00
|
|
|
|
|
|
|
# read html
|
2015-05-17 11:49:35 +02:00
|
|
|
html = website.text
|
2014-04-21 15:55:09 +02:00
|
|
|
|
|
|
|
# use re.findall to grab all the links
|
|
|
|
links = re.findall('"((http|ftp)s?://.*?)"', html)
|
|
|
|
|
|
|
|
# output links
|
|
|
|
for link in links:
|
2015-05-17 11:49:35 +02:00
|
|
|
print(link[0])
|