python刷取CSDN博文访问量之二
作者:vpoet
注:这个系列我只贴代码,代码不注释.有兴趣的自己读读就懂了,纯属娱乐,望管理员抬手
     若有转载一定不要注明来源
 #coding=utf-8
import webbrowser
import time
import urllib2
import re
import os
import thread
import threading
mylock = threading.RLock() tabcount=1 def BlogFun(n,url,MaxVisitor,threadnumber):
visitcount = r'<span class="link_view" title="阅读次数">(\d+)人阅读</span>'
global tabcount
while True:
mylock.acquire()
if tabcount >10:
os.system('taskkill /F /IM chrome.exe')
tabcount = 1
else:
tabcount = tabcount + 1
mylock.release()
webbrowser.open(url,new=1)
request=urllib2.Request(url)
request.add_header('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6')
opener = urllib2.build_opener()
fblog = opener.open(request)
htm = fblog.read()
Ref=re.findall(visitcount,htm)
time.sleep(n)
if int(Ref[0])>MaxVisitor:
break if __name__=="__main__": main_url = "http://blog.csdn.net/u013018721/article/details/37996979" threadSum= 5
MaxVisitor = 1050
timedelay=3
print main_url+" 开启模式... "+"\n"
for threadnumber in range(threadSum):
thread.start_new_thread(BlogFun,(timedelay,main_url,MaxVisitor,threadnumber,))
threadnumber=threadnumber+1 print "Main Thread Over.............."

python刷取CSDN博文访问量之二的更多相关文章

  1. python刷取CSDN博文访问量之四

    python刷取CSDN博文访问量之四 作者:vpoet #coding:utf-8 import requests import urllib2 import re import time def ...

  2. python刷取CSDN博文访问量之三

    python刷取CSDN博文访问量之三   作者:vpoet 注:这个系列我只贴代码,代码不注释.有兴趣的自己读读就懂了,纯属娱乐,望管理员抬手若有转载一定不要注明来源 #coding=utf-8 i ...

  3. python刷取CSDN博文访问量之一

    python刷取CSDN博文访问量之一 作者:vpoet 注:这个系列我只贴代码,代码不注释.有兴趣的自己读读就懂了,纯属娱乐,望管理员抬手 若有转载一定不要注明来源   #coding=utf-8 ...

  4. Python爬取CSDN博客文章

    0 url :http://blog.csdn.net/youyou1543724847/article/details/52818339Redis一点基础的东西目录 1.基础底层数据结构 2.win ...

  5. 使用python抓取CSDN关注人的全部公布的文章

    # -*- coding: utf-8 -*- """ @author: jiangfuqiang """ import re import ...

  6. 利用Python抓取CSDN博客

    这两天发现了一篇好文章,陈皓写的makefile的教程,具体地址在这里<跟我一起写makefile> 这篇文章一共分成了14个部分,我看东西又习惯在kindle上面看,感觉一篇一篇地复制成 ...

  7. Python 爬取CSDN博客频道

    初次接触python,写的很简单,开发工具PyCharm,python 3.4很方便 python 部分模块安装时需要其他的附属模块之类的,可以先 pip install wheel 然后可以直接下载 ...

  8. python抓取链家房源信息(二)

    试着用scrapy将之前写的抓取链家网信息的重新写了写 然后先是用了第一页的网页作为测试,调试代码,然后发现总是抓取的时候遇见了 类似于这样的问题,并且抓取不到信息 2017-03-28 17:52: ...

  9. [Python]爬取CSDN论坛 标题 2020.2.8

    首先新建一个Lei.txt 内容为: CloudComputingParentBlockchainTechnologyEnterpriseDotNETJavaWebDevelopVCVBDelphiB ...

随机推荐

  1. Controller 中Action 返回值类型 及其 页面跳转的用法

        •Controller 中Action 返回值类型 View – 返回  ViewResult,相当于返回一个View 页面. -------------------------------- ...

  2. Gray Code 解答

    Question The gray code is a binary numeral system where two successive values differ in only one bit ...

  3. POJ3669(Meteor Shower)(bfs求最短路)

    Meteor Shower Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12642   Accepted: 3414 De ...

  4. qcow2 raw vhd 虚拟磁盘转换

    Centos-6.4-x86_64_Ruiy.vhd: Microsoft Disk Image, Virtual Server or Virtual PC

  5. ios相册

    1, 系统图片剪裁的问题 http://www.cnblogs.com/liulunet/archive/2013/01/19/2866399.html

  6. 决策树之ID3算法实现(python)

    决策树的概念其实不难理解,下面一张图是某女生相亲时用到的决策树: 基本上可以理解为:一堆数据,附带若干属性,每一条记录最后都有一个分类(见或者不见),然后根据每种属性可以进行划分(比如年龄是>3 ...

  7. java-程序执行原理

    java应用可以打包成jar 格式,jar格式其实只是一种很普通的压缩格式,与zip格式一样,只不过是它会在压缩文件的目录结构中增加一个META-INF/ MANIFEST.MF 的元文件. 我们知道 ...

  8. Android应用程序的Activity启动过程简要介绍和学习计划

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/6685853 在Android系统中,Activ ...

  9. Android控件TextView的实现原理分析

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8636153 在前面一个系列的文章中,我们以窗口 ...

  10. windows 和linux 同步api对比

    初始化临界区 (win) InitializeCriticalSection(RTL_CRITICAL_SECTION &rtl_critial_section) (linux) pthrea ...