python实现seo疯狂外链发送工具

网站外链发送工具

进来无事,抽空用python实现seo疯狂发送外链的工具。外链对网站优化来说是一个加分项,外链越多、质量越高那么对网站优化也越有利。通常网上有很多外链发送工具,其实是对各大网站平台接口推送网站域名,大网站平台一般来说是有缓存机制的,而且百度蜘蛛抓取频率比较高,那么发送到该网站上的域名,是有机会被百度蜘蛛抓取到的,一个大站推荐了一个小站,那么权重就比较容易上去,这是群发外链的基本原理。

python实现代码

Ui_main.py

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'd:\workspace\python\my_tools\main.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(180, 70, 371, 71))
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(120, 164, 72, 21))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(20)
        font.setBold(True)
        font.setWeight(75)
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.domain_lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.domain_lineEdit.setGeometry(QtCore.QRect(180, 160, 331, 31))
        self.domain_lineEdit.setObjectName("domain_lineEdit")
        self.go_pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.go_pushButton.setGeometry(QtCore.QRect(520, 160, 93, 28))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.go_pushButton.setFont(font)
        self.go_pushButton.setObjectName("go_pushButton")
        self.progressBar = QtWidgets.QProgressBar(self.centralwidget)
        self.progressBar.setGeometry(QtCore.QRect(100, 490, 511, 23))
        self.progressBar.setProperty("value", 24)
        self.progressBar.setObjectName("progressBar")
        self.show_label = QtWidgets.QLabel(self.centralwidget)
        self.show_label.setGeometry(QtCore.QRect(120, 210, 561, 16))
        self.show_label.setText("")
        self.show_label.setObjectName("show_label")
        self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget)
        self.textBrowser.setGeometry(QtCore.QRect(130, 270, 511, 151))
        self.textBrowser.setObjectName("textBrowser")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "疯狂外链发送工具"))
        self.label.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:26pt; font-weight:600; color:#ff0000;\">疯狂外链发送工具</span></p></body></html>"))
        self.label_2.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:12pt;\">http://</span></p></body></html>"))
        self.domain_lineEdit.setText(_translate("MainWindow", "www.h3blog.com"))
        self.go_pushButton.setText(_translate("MainWindow", "Go"))

main.py

from PyQt5.QtWidgets import QMainWindow, QApplication
from Ui_main import Ui_MainWindow
import sys
from service import SendUrlsThread

class MainWindow(QMainWindow, Ui_MainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)

        self.progressBar.setVisible(False)
        self.progressBar.reset()
        self.progressBar.setValue(0)

        self.logstr = ''

        self.go_pushButton.clicked.connect(self.go_clicked)


    def go_clicked(self):

        self.go_pushButton.setDisabled(True)
        domain = self.domain_lineEdit.text()
        print(domain)
        self.progressBar.setVisible(True)
        sendService = SendUrlsThread(domain)
        sendService.progress_signal.connect(self.change_progressbar_value)
        sendService.start()
        sendService.exec()


    def change_progressbar_value(self,value, num, url):
        # print(value)
        self.progressBar.setValue(value)
        self.show_label.setText(url)
        if value == 100:
            self.go_pushButton.setDisabled(False)
            self.textBrowser.append(url)
        else:
            log = '[{}] {}'.format(num, url)
            self.textBrowser.append(log)

if __name__ == "__main__":
    app = QApplication(sys.argv)
    mainWin = MainWindow()
    mainWin.show()

    sys.exit(app.exec_())

service.py

from data import urls

import requests
import re
import random
from PyQt5.QtCore import QThread, pyqtSignal


ua_list = [
            "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1",
            "Mozilla/5.0 (X11; CrOS i686 2268.111.0) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11",
            "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6",
            "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6",
            'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'
        ]



class SendUrlsThread(QThread):
    progress_signal = pyqtSignal(int,int,str)

    def __init__(self,domain):
        super(SendUrlsThread,self).__init__()
        self.domain = domain

    def run(self):
        total = len(urls)
        print(total,self.domain)
        i = 0
        for url in urls:
            pcount = len(re.findall('{}',url))
            args = [self.domain for i in range(pcount)]
            url = url.format(*args)
            self.send(url)
            i = i + 1
            current = int(i/total * 100)
            if current == 100:
                url = '完成'
            self.progress_signal.emit(current, i, url)


    def send(self,url):
        try:
            user_agent = random.choice(ua_list)
            headers = {'User-Agent': user_agent}
            res = requests.get(url, headers=headers , timeout=3, verify=False)
            if res.status_code == 200:
                return True
        except Exception as e:
            print(e)

data.py

urls = ["https://www.36kr.com/search/articles/{}", "https://www.xbeian.com/ga2_{}.html"]

总结

该工具适合每天进行发送才有效果,原理文章开头已经写了,有需要疯狂外链发送工具的请关注公众号"何三笔记" 回复 疯狂外链发送工具 即可获取下载地址

何三笔记