【小白入门】用Python增加文章阅读量

安装requests

pip install requests

启动代码

import requests
import random
def get_html(html_url):
    headers = {
      'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36'
    }
    response = requests.get(url=html_url, headers=headers)
    return response
url_data = [
  "https://blog.csdn.net/weixin_37474682/article/details/119741032",#【李宏毅深度学习CP1-2】(task1)机器学习简介
  "https://blog.csdn.net/weixin_37474682/article/details/119762765",# 使用rocketmq,rocketmq-client-python的api开发rocketmq生产者和消费者
  "https://blog.csdn.net/weixin_37474682/article/details/119765401",#【python pypinyin】汉语拼音字典切换方法
  "https://blog.csdn.net/weixin_37474682/article/details/119785984",#【李宏毅深度学习CP3-4】(task2)回归
  "https://blog.csdn.net/weixin_37474682/article/details/119809428",# python redis 小白入门教程
  "https://blog.csdn.net/weixin_37474682/article/details/119843684",# VSCode 新建python虚拟环境
  "https://blog.csdn.net/weixin_37474682/article/details/119855092",# 【牛客网华为机试】HJ1 字符串最后一个单词的长度
  "https://blog.csdn.net/weixin_37474682/article/details/119855440",# 【牛客网华为机试】HJ2 计算某字母出现次数
  "https://blog.csdn.net/weixin_37474682/article/details/119878441",# 【牛客网华为机试】HJ3 明明的随机数
  "https://blog.csdn.net/weixin_37474682/article/details/119880358",# 【牛客网华为机试】HJ4 字符串分隔
  "https://blog.csdn.net/weixin_37474682/article/details/119898691",# 【牛客网华为机试】HJ5 进制转换
  "https://blog.csdn.net/weixin_37474682/article/details/119899324",# 【牛客网华为机试】HJ6 质数因子
  "https://blog.csdn.net/weixin_37474682/article/details/119921421",# 【牛客网华为机试】HJ7 取近似值
  "https://blog.csdn.net/weixin_37474682/article/details/119921505",# 【牛客网华为机试】HJ8 合并表记录
  "https://blog.csdn.net/weixin_37474682/article/details/119935044",# 【小白入门】用Python增加知乎文章阅读量
  "https://blog.csdn.net/weixin_37474682/article/details/119943208",# 【牛客网华为机试】HJ9 提取不重复的整数
  "https://blog.csdn.net/weixin_37474682/article/details/119943251",# 【牛客网华为机试】HJ10 字符个数统计
  "https://blog.csdn.net/weixin_37474682/article/details/119960868",# 【牛客网华为机试】HJ11 数字颠倒
  "https://blog.csdn.net/weixin_37474682/article/details/119967058",# 【牛客网华为机试】HJ12 字符串反转
  "https://blog.csdn.net/weixin_37474682/article/details/119967224",# 【牛客网华为机试】HJ13 句子逆序
  "https://blog.csdn.net/weixin_37474682/article/details/119967404",# 【牛客网华为机试】HJ14 字符串排序
  ]
import time
while True:
  try:
    url = random.choice(url_data)
    get_html(url)
    time.sleep(10)
  except:
      time.sleep(60)
  • 8
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

202xxx

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值