找出所有鏈接的python腳本

jopen 9年前發布 | 763 次閱讀 Python

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])</pre>


 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!