今天给大家分享一个很好玩的东西,那就是用python实现日发300W外链不是梦的超级外链系统。
在放代码之前,先说一下超级外链系统产生的背景及原理(大神请忽略,主要是给小白讲讲原理)。
拿一个示例给大家看看:
上面的就是词库这个站的搜索结果被百度收录了的结果。那么如果我们找到很多个这种可以被百度收录的搜索结果接口,是不是就可以批量的进行了呢?
我这里从市面上的一些超级外链工具那里整理了一些接口出来给大家,但是有的接口似乎已经没有收录了或者是不能用了,关于这个大家自己筛选就好了。然后我说一下整个外链系统的结构和配置:
主要说下搜索接口文件是怎么配置的:
比如我们自己找到一个可用的搜索接口地址
https://www.ciku5.com/s?wd=www.itseo.net&citype=1
那么这个地址里面的搜索词部分就是我们要改的地方,上面是www.itseo.net,我们要把他改成
https://www.ciku5.com/s?wd={url}&citype=1
这样的,就是把搜索词换成{url},别的都不用变。下面给多几个例子:
https://i.zzbbx.com/?weburl={url} https://pr.alexa.cn/index.php?url=https://{url} https://tool.alexa.cn/?url={url}&RandPasswd=123 https://whois.toolsky.com/?domain={url} https://pr.toolsky.com/pr.asp?domain={url} https://www.sumotorrent.com/en/search/{url} https://alexa.toolsky.com/?url={url} https://www.920a.com/{url}.html
至于要发布的链接文件domains.txt 里面就存放你的链接就好了,一行一条链接。url网址不要加https://,如:
www.jiankang.com/yinshi/article/21882.shtml jbk.jiankang.com/zhengzhuang/ jbk.jiankang.com/zhengzhuang/buwei-6/
python的代码实现:
# -*- coding: utf-8 -*- """ python版超级外链发布系统 基于python2.7.13开发,不支持python3.X 需要安装第三方模块: requests 安装方法: pip install requests 作者: brooks 公众号: 布鲁的python """ from threading import Thread from Queue import Queue import requests class Spider(Thread): def __init__(self, queue): Thread.__init__(self) self.queue = queue self.headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4)' ' AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 ' 'Safari/537.36' } def run(self): while True: url = self.queue.get() try: resp = requests.get(url, headers=self.headers, timeout=30) print 'push: {}\t{}'.format(url, resp.ok) except requests.exceptions.RequestException: print 'push: {}\t{}'.format(url, "False") finally: self.queue.task_done() if __name__ == '__main__': check_host = [check.strip() for check in open('checkhost.txt')] # 查询网站列表 domains = [d.strip() for d in open('domains.txt')] # 要查询的链接列表 check_q = Queue() for check in check_host: for domain in domains: curl = check.format(url=domain) check_q.put(curl) for i in xrange(30): sp = Spider(check_q) sp.setDaemon(True) sp.start() check_q.join() print 'done'
说明: 多线程运行的,最好在Linux系统或者是Mac系统运行。windows系统的可以放到虚拟机里面运行。不然的话可能会有中文乱码问题。
运行程序
配置好接口和链接之后在程序的文件目录下,打开终端,输入如下命令:
python superlink.py
运行结果示例
说明:连接后面显示True就表示推送链接成功,False表示失败
最后一点说明,运行这个需要会安装python环境以及安装第三方模块,不懂的话可以学习一下。
完整的文件我已经打包了,需要的可以到我的QQ群里面索要:
群号:287146242
资料在群共享里面spuerlink.zip 想学习python的也可以进来交流。
微信公众号:布鲁的python
代码已经测试成功,显示true,然后怎么看我的外链发布成功了呢
改成PYTHON3 可以使用的样子了
#! /usr/bin/env python
# -*-coding:utf8-*-
from threading import Thread
import queue
import requests
class Spider(Thread):
def __init__(self, queue):
Thread.__init__(self)
self.queue = queue
self.headers = {
‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4)’
‘ AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 ‘
‘Safari/537.36’
}
def run(self):
while True:
url = self.queue.get()
try:
resp = requests.get(url, headers=self.headers, timeout=30)
print (‘push: {}\t{}’.format(url, resp.ok))
except requests.exceptions.RequestException:
print (‘push: {}\t{}’.format(url, “False”))
finally:
self.queue.task_done()
if __name__ == ‘__main__’:
check_host = [check.strip() for check in open(‘checkhost.txt’)] # 查询网站列表
domains = [d.strip() for d in open(‘domains.txt’)] # 要查询的链接列表
check_q = queue.Queue()
for check in check_host:
for domain in domains:
curl = check.format(url=domain)
check_q.put(curl)
for i in range(30):
sp = Spider(check_q)
sp.setDaemon(True)
sp.start()
check_q.join()
print (‘done’)
很优秀