找出所有链接的python脚本
发布时间:2020-05-25 01:06:10 所属栏目:Python 来源:互联网
导读:找出所有链接的python脚本
|
下面是脚本之家 jb51.cc 通过网络收集整理的代码片段。 脚本之家小编现在分享给大家,也给大家做个参考。 import requests
import re
# get url
url = input('Enter a URL (include `http://`): ')
# connect to the url
website = requests.get(url)
# read html
html = website.text
# use re.findall to grab all the links
links = re.findall('"((http|ftp)s?://.*?)"',html)
# output links
for link in links:
print(link[0])
|
