老域名清洗,批量查询搜狗权重

#!/usr/bin/env python3
#
import requests,re

def get_sr(yuming):

	url = 'http://rank.ie.sogou.com/sogourank.php?ur=http://www.{}/'.format(yuming)

	headers = {

		'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36',
		'Cookie': 'IPLOC=CN3100; SUV=1564716615883303; CXID=5B78AB771BFDB3EAD98DD392131406F1; SUID=2AA5983D2E18960A000000005CF643BA; pgv_pvi=8945762304; usid=BlYJ-7A842pJRX8P; front_screen_resolution=1920*1080; wuid=AAHEvTxAKQAAAAqMGE0EKgEA1wA=; FREQUENCY=1565676969727_13; SNUID=7A60BBA01411862ACF72A2D314939FC1; ad=P7lHvkllll2NFn$DlllllVCiovklllllH3P8bkllllylllllRjoll5@@@@@@@@@@; pgv_si=s2028934144; sct=32; ld=wZllllllll2NzG7tlllllVCiMRDlllllH3P8bkllllclllllRllll5@@@@@@@@@@',
		'Host': 'rank.ie.sogou.com',
	}

	html = requests.get(url=url,headers=headers,timeout=10)
	html_sr = html.text
	sr = re.findall(r'sogourank=(\d|\d\d)',html_sr,re.S)
	return int(sr[0])

if __name__ == '__main__':
	
	sr_txt = open('sr.txt','w')

	with open('yuming.txt') as yuming:

		for ym in yuming:

			ym = ym.strip()

			sogourank = get_sr(ym)

			if sogourank > 1:

				print(ym,sogourank)

				sr_txt.write(ym+'\t'+str(sogourank)+'\n')
	sr_txt.close()


本文由站长原创或收集,不代表本站立场,如若转载,请注明出处:https://pds.ac.cn/jishu/36.html

本文 暂无 评论

回复给

欢迎点评

联系我们

站长QQ:770083771

站长邮件:770083771@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code