海外翻墙免费加速器:[入口]
对于seo来说,域名年龄是判断网站竞争力的重要指标。
批量获取域名年龄脚本如下:
#coding:utf-8
#author:http://www.chenhaifei.com/
import requests #打开
import time,random #控制时间
import sys #专门乱码的
from bs4 import BeautifulSoup as bs #把html结构化
headers={
‘Accept’:’text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3′,
‘Accept-Encoding’:’gzip, deflate’,
‘Accept-Language’:’zh-CN,zh;q=0.9,ja;q=0.8,en;q=0.7′,
‘Cache-Control’:’max-age=0′,
‘Connection’:’keep-alive’,
‘Cookie’:’qHistory=aHR0cDovL3Nlby5jaGluYXouY29tX1NFT+e7vOWQiOafpeivonxodHRwOi8vd2hvaXMuY2hpbmF6LmNvbS8rV2hvaXPmn6Xor6J8aHR0cDovL3JhbmsuY2hpbmF6LmNvbS9yYW5rYWxsL1/mnYPph43nu7zlkIjmn6Xor6J8aHR0cDovL3JhbmsuY2hpbmF6LmNvbV/nmb7luqbmnYPph43mn6Xor6J8aHR0cDovL2lwLnRvb2wuY2hpbmF6LmNvbV9JUC/mnI3liqHlmajlnLDlnYDmn6Xor6I=; UM_distinctid=173c1bd087f5f-00319a79176aa1-3f385804-100200-173c1bd088028a; CNZZDATA433095=cnzz_eid%3D1741314019-1596680313-%26ntime%3D1596680313; Hm_lvt_ca96c3507ee04e182fb6d097cb2a1a4c=1596683258; CNZZDATA5082706=cnzz_eid%3D760155605-1596678464-%26ntime%3D1596678464; toolbox_urls=www.njlymy.com; Hm_lpvt_ca96c3507ee04e182fb6d097cb2a1a4c=1596683262′,
‘Host’: ‘seo.chinaz.com’,
‘Referer’:’http://seo.chinaz.com/’,
‘Upgrade-Insecure-Requests’:’1′,
‘User-Agent’:’Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36′
}
with open (‘url.txt’) as f:
for link in f:
url=’http://seo.chinaz.com/’+link.strip()
print (url)
cont = requests.get(url,timeout=120,headers=headers).content#get方法获取内容
soup = bs(cont, “html.parser”)#BeautifulSoup把html结构化
seo_new1 = soup.find(‘div’,{‘class’:”_chinaz-seo-new1″}) #find方法定位
seo_newt = seo_new1.find(‘table’,{‘class’:”_chinaz-seo-newt”})#find方法定位
seo_span=seo_newt.find_all(‘span’)[12]#find_all获取列表,[12]获取列表第13列
seo_a=seo_span.find(‘a’).text.strip()#find+text+strip()方法
txt=open(‘text.txt’,’a’)
txt.write(link.strip()+’\t’+seo_a+’\n’)
txt.close()
time.sleep(3)
批量获取域名年龄脚本截图:
ps:脚本如果直接复制粘贴的话会有语法错误,需要自行修改,由于流量限制不放脚本文件下载,如果有这方面需求的可以联系博主本人(ps:有偿)。