快速提高CSDN訪問量的方法
- 多寫常用知識點的博客,想辦法提高百度排名,注意標題不要寫的太復雜
- 寫國內比較新的技術,中短期奇效,效果很好
- 成系列的寫技術文章,有利於增加評論,粉絲,中長期能夠大幅度提高日常訪問量
- 成系列的專欄,利於增加粉絲,亦能提高日常訪問量,同上
- 想辦法讓文章推薦到首頁,可在短時間內增加訪問量,
- 大招:腳本,有一個已經寫好了的腳本在最后,但是不建議
- 大招二,水軍,還可以獲得很多評論,然並卵,非常不建議
訪問CSDN的腳本-初代機
代碼使用簡介
- 在CSDN判定為攻擊時可以拋出異常,繼續下一次訪問,直到達到訪問次數
- 隨機睡眠時間,隨機抽取訪問列表,也可以通過列表內容控制訪問博客
- 各類參數已經設置默認值,原始默認值運行結果良好
- csdn.start()的maxTime參數是默認整個列表的訪問次數,具體訪問量為:
maxTime*len(self.blog_url)
源碼
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/75212825',
'http://blog.csdn.net/FontThrone/article/details/75136885',
'http://blog.csdn.net/FontThrone/article/details/75042659',
'http://blog.csdn.net/FontThrone/article/details/74230603',
'http://blog.csdn.net/FontThrone/article/details/74201764',
]
class CSDN(object):
def __init__(self, blog_url=blog_url, csdn_url="http://blog.csdn.net/fontthrone"):
self.blog_url = blog_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
while tries < maxTryNum:
try:
socket.setdefaulttimeout
req = urllib2.Request(link, None, self.headers)
resp = urllib2.urlopen(req, None, timeout)
html = resp.read()
print "Success!\t",
print "Rest ", sleepTime, " seconds to continue...\n"
tries += 1
time.sleep(sleepTime)
except:
if tries < (maxTryNum):
maxNum += 1
continue
else:
print("Has tried %d times to access blog link %s, all failed!", maxNum, link)
break
def start(self, maxTime=100, blOpenCsdn=False, sleepTimeStart=5, sleepTimeEnd=15, timeout=60):
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(sleepTimeStart, sleepTimeEnd), timeout=timeout)
print "Now is "+ str(i + 1) +" times to acess blog link\n"
csdn = CSDN()
inputMaxTime = input(u'請輸入列表訪問次數\n')
csdn.start(maxTime =int(inputMaxTime))
所有使用我寫的腳本的童鞋,請留個評論再走,滑稽(手動輸入SVIP限定版)