zoukankan      html  css  js  c++  java
  • 通过多线程的方式刷csdn浏览量

     1 import requests
     2 import time
     3 import threading
     4 def Thread():
     5     url = ['https://blog.csdn.net/qq_40822132/article/details/105361968',
     6            'https://blog.csdn.net/qq_40822132/article/details/105359571',
     7            'https://blog.csdn.net/qq_40822132/article/details/105359476',
     8            'https://blog.csdn.net/qq_40822132/article/details/105269815',
     9            'https://blog.csdn.net/qq_40822132/article/details/105260175',
    10            'https://blog.csdn.net/qq_40822132/article/details/105070726',
    11            'https://blog.csdn.net/qq_40822132/article/details/105028436',
    12            'https://blog.csdn.net/qq_40822132/article/details/104739744',
    13            'https://blog.csdn.net/qq_40822132/article/details/104373265',
    14            'https://blog.csdn.net/qq_40822132/article/details/104372185',
    15            'https://blog.csdn.net/qq_40822132/article/details/105631011',
    16            'https://blog.csdn.net/qq_40822132/article/details/105243506',
    17            'https://blog.csdn.net/qq_40822132/article/details/105064770',
    18            'https://blog.csdn.net/qq_40822132/article/details/105028667',
    19            'https://blog.csdn.net/qq_40822132/article/details/104373801',
    20            'https://blog.csdn.net/qq_40822132/article/details/104373515',
    21            'https://blog.csdn.net/qq_40822132/article/details/104373057',
    22            'https://blog.csdn.net/qq_40822132/article/details/104372588',
    23            'https://blog.csdn.net/qq_40822132/article/details/104371595',
    24            'https://blog.csdn.net/qq_40822132/article/details/104371081',
    25            'https://blog.csdn.net/qq_40822132/article/details/104302215',
    26            'https://blog.csdn.net/qq_40822132/article/details/104372811',
    27            'https://blog.csdn.net/qq_40822132/article/details/104303954',
    28            'https://blog.csdn.net/qq_40822132/article/details/104303482',
    29            'https://blog.csdn.net/qq_40822132/article/details/104302722',
    30            'https://blog.csdn.net/qq_40822132/article/details/104300872',
    31            'https://blog.csdn.net/qq_40822132/article/details/104300620',
    32            'https://blog.csdn.net/qq_40822132/article/details/104300124',
    33            'https://blog.csdn.net/qq_40822132/article/details/104299547',
    34            'https://blog.csdn.net/qq_40822132/article/details/104143837',
    35            'https://blog.csdn.net/qq_40822132/article/details/103959989',
    36            'https://blog.csdn.net/qq_40822132/article/details/103956114',
    37            'https://blog.csdn.net/qq_40822132/article/details/103947197',
    38            'https://blog.csdn.net/qq_40822132/article/details/103947136',
    39            'https://blog.csdn.net/qq_40822132/article/details/103750154',
    40            'https://blog.csdn.net/qq_40822132/article/details/103750109',
    41            'https://blog.csdn.net/qq_40822132/article/details/103750079',
    42            'https://blog.csdn.net/qq_40822132/article/details/105743025',
    43            'https://blog.csdn.net/qq_40822132/article/details/103960533',
    44            'https://blog.csdn.net/qq_40822132/article/details/103750037',
    45            'https://blog.csdn.net/qq_40822132/article/details/103749970',
    46            'https://blog.csdn.net/qq_40822132/article/details/103749904',
    47            'https://blog.csdn.net/qq_40822132/article/details/103748249',
    48            'https://blog.csdn.net/qq_40822132/article/details/103748165']
    49     headers = {
    50         'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36'}
    51     count = 0
    52     countUrl = len(url)
    53     # 访问次数设置
    54     while count < 100000:
    55         try:  # 正常运行
    56             for i in range(countUrl):
    57                 response = requests.get(url[i], headers=headers)
    58                 if response.status_code == 200:
    59                     count = count + 1
    60                     print('Success ' + str(count), 'times')
    61             time.sleep(20)
    62         except Exception:  # 异常
    63             print('Failed and Retry')
    64             time.sleep(30)
    65 t1=threading.Thread(target=Thread)
    66 t2=threading.Thread(target=Thread)
    67 t3=threading.Thread(target=Thread)
    68 t4=threading.Thread(target=Thread)
    69 t1.start()
    70 t2.start()
    71 t3.start()
    72 t4.start()
  • 相关阅读:
    artZoom 图片可放大旋转
    Node.js究竟是什么?
    图片上传 纯js编码
    图片上传jQuery插件(兼容IE8)
    nodejs API(二)
    zuul网关
    Hystrix集群及集群监控turbine
    熔断器Hystrix及服务监控Dashboard
    Ribbon负载均衡及Feign消费者调用服务
    Eureka集群
  • 原文地址:https://www.cnblogs.com/ZhangPengPeng/p/12800450.html
Copyright © 2011-2022 走看看