wydomain
wydomain copied to clipboard
结果整合问题
最近使用猪哥的工具 发现返回结果没有域名的标题啥的
自己写了个小脚本 希望猪哥参考添加进去
`import requests
import json
from bs4 import BeautifulSoup
domain = set() jsonname = ['alexa.json', 'chaxunla.json', 'dnsburte.json', 'ilinks.json', 'netcraft.json', 'sitedossier.json' , 'threatminer.json'] def do_json(name): with open(name) as f: data = json.load(f) return data
def get_title(url): try: headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 UBrowser/6.0.1471.914 Safari/537.36'} url = 'http://'+url print(url) response = requests.get(url=url, headers=headers,timeout=5,verify=False) response.encoding = response.apparent_encoding response = BeautifulSoup(response.text,'lxml') title = response.html.title.get_text() except: title = '空' return title
for i in jsonname: for url in do_json(name=i): domain.add(url)
with open('result.txt','w',errors='ignore') as f: for i in domain: title = get_title(url=i) print(title) f.write(i+' '+title+'\n')
`