python实现超级外链发布系统

今天给大家分享一个很好玩的东西,那就是用python实现日发300W外链不是梦的超级外链系统。
在放代码之前,先说一下超级外链系统产生的背景及原理(大神请忽略,主要是给小白讲讲原理)。

  • 外链的作用其实就是为了让用户或蜘蛛通过这个链接能够发现我们自己的网站或页面,提升页面的曝光度。从收录的角度来讲,提升曝光度可以使得页面更容易被搜索引擎发现,然后抓取收录。
  • 常见的发外链手段其实就是去那些论坛、博客等地方留言,发帖等等。但是这些都是需要浪费比较多的人力和精力去做。效果嘛,也不一定见得有多好。而且如果发得多还容易被封什么的,注册账号也是一个不小的麻烦。
  • 那么还有什么更好的办法去曝光链接吗?我们发现,其实很多的网站都有搜索功能,而且这些站会缓存这些搜索结果,一般会在标题或者是搜索结果里面出现我们的搜索词,而且这些站的搜索结果页是可能被搜索引擎收录的。那么假如我们把这些搜搜词换成url呢?这些url是否就有可能会被搜索引擎抓取到啦。
  • 当然还有一种搜索结果是比较特殊的,那就是搜索引擎自身的搜索结果也是可以利于搜索引擎发现我们的url的地方。
  • 超级外链系统就是利用了这个特性,通过找到一批这样的搜索链接来进行批量的请求,来模拟人工的搜索,从而达到发布的外链的作用。
  • 拿一个示例给大家看看:
    示例
    上面的就是词库这个站的搜索结果被百度收录了的结果。那么如果我们找到很多个这种可以被百度收录的搜索结果接口,是不是就可以批量的进行了呢?
    我这里从市面上的一些超级外链工具那里整理了一些接口出来给大家,但是有的接口似乎已经没有收录了或者是不能用了,关于这个大家自己筛选就好了。然后我说一下整个外链系统的结构和配置:

  • 整个系统一共由三个文件组成,一个是主要的python运行文件(superlink.py),这个文件不懂的可以不用动。
  • 一个是存放可用的搜索接口的txt文件(checkhost.txt)。
  • 还有一个就是你要的发布的链接文件(domains.txt)。
  • 主要说下搜索接口文件是怎么配置的:
    比如我们自己找到一个可用的搜索接口地址
    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

    3 thoughts on “python实现超级外链发布系统”

    1. 改成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’)

      回复

    Leave a Comment