快速提高CSDN访问量

快速提高CSDN访问量的方法

  • 多写常用知识点的博客,想办法提高百度排名,注意标题不要写的太复杂
  • 写国内比较新的技术,中短期奇效,效果很好
  • 成系列的写技术文章,有利于增加评论,粉丝,中长期能够大幅度提高日常访问量
  • 成系列的专栏,利于增加粉丝,亦能提高日常访问量,同上
  • 想办法让文章推荐到首页,可在短时间内增加访问量,
  • 大招:脚本,有一个已经写好了的脚本在最后,但是不建议
  • 大招二,水军,还可以获得很多评论,然并卵,非常不建议

访问CSDN的脚本-初代机

代码使用简介

  • 在CSDN判定为攻击时可以抛出异常,继续下一次访问,直到达到访问次数
  • 随机睡眠时间,随机抽取访问列表,也可以通过列表内容控制访问博客
  • 各类参数已经设置默认值,原始默认值运行结果良好
  • csdn.start()的maxTime参数是默认整个列表的访问次数,具体访问量为: maxTime*len(self.blog_url)
  • 2017/08/05/ 更新

源码

# - * - coding: utf - 8 -*-
#
# 作者:田丰(FontTian)
# 创建时间:'2017/7/17'
# 邮箱:fonttian@Gmaill.com
# CSDN:http://blog.csdn.net/fontthrone
import sys

reload(sys)
sys.setdefaultencoding('utf-8')

import urllib2
import socket
import time
import re
import random

blog_url =[
    'http://blog.csdn.net/fontthrone/article/details/76675684',
    'http://blog.csdn.net/FontThrone/article/details/76652772',
    'http://blog.csdn.net/FontThrone/article/details/76652762',
    'http://blog.csdn.net/FontThrone/article/details/76652753',
    'http://blog.csdn.net/FontThrone/article/details/76652257',
    'http://blog.csdn.net/fontthrone/article/details/76735591',
    'http://blog.csdn.net/FontThrone/article/details/76728083',
    'http://blog.csdn.net/FontThrone/article/details/76727466',
    'http://blog.csdn.net/FontThrone/article/details/76727412',
    'http://blog.csdn.net/FontThrone/article/details/76695555',
    'http://blog.csdn.net/fontthrone/article/details/75805923',
]



class CSDN(object):
    def __init__(self, blog_url=blog_url, csdn_url="http://blog.csdn.net/fontthrone"):
        self.blog_url = blog_url
        self.csdn_url = csdn_url
        self.headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
            'Accept': 'text/html;q=0.9,*/*;q=0.8',
            'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
            'Accept-Encoding': 'gzip',
            'Connection': 'close',
            'Referer': None
        }

    def openCsdn(self):
        req = urllib2.Request(self.csdn_url, headers=self.headers)
        response = urllib2.urlopen(req)
        thePage = response.read()
        response.close()
        pattern = "访问:<span>(d+)次</span>"
        number = ''.join(re.findall(pattern, thePage))
        return number

    def openBlog(self, link='http://blog.csdn.net/fontthrone/article/details/70556507', timeout=60, sleepTime=22,
                 maxTryNum=1):
        tries = 0
        maxNum = 0
        # for tries in range(maxTryNum):
        while tries < maxTryNum:
            try:
                socket.setdefaulttimeout
                req = urllib2.Request(link, None, self.headers)
                resp = urllib2.urlopen(req, None, timeout)
                html = resp.read()
                print "Success!	",
                print "Rest ", sleepTime, " seconds to continue...
"
                tries += 1
                time.sleep(sleepTime)
            except:
                if tries < (maxTryNum):
                    maxNum += 1
                    print("Has tried %d times to access blog link %s, all failed!", maxNum, link)
                    continue
                else:
                    print("Has tried %d times to access blog link %s, all failed!", maxNum, link)
                    break

    def start(self, maxTime=100, blOpenCsdn=False, sleepTimeMin=15, sleepTimeMax=60, timeout=60):
    # 在此处修改默认的参数,[sleepTimeMin,sleepTimeMax],为最小和最大睡眠时间,具体时间由随机数控制
    # timeout 为url访问的最大等待时间
    # 访问列表是随机访问的,maxTime 为访问列表的迭代次数,每次迭代的具体数量 = len(urlList),因为每次访问都是随机的,一轮结束后,可能并非是每一个链接都被访问了一遍,
        for i in range(maxTime * len(self.blog_url)):
            randomLink = random.choice(self.blog_url)
            print 'This tinme the random_blog link is ', randomLink
            if blOpenCsdn == True:
                self.openCsdn()
            self.openBlog(link=randomLink, sleepTime=random.uniform(sleepTimeMin, sleepTimeMax), timeout=timeout)
            print "Now is " + str(i + 1) + " times to acess blog link
"


csdn = CSDN()
inputMaxTime = input(u'请输入列表访问次数 :
')
csdn.start(maxTime=int(inputMaxTime))

所有使用我写的脚本的童鞋,评论666再走,滑稽(手动输入SVIP限定版)

  • 既然有初代机自然也就有二代机,嘿嘿
  • 老铁,这都没毛病
原文地址:https://www.cnblogs.com/fonttian/p/9162811.html