python论坛签到_Python 百度贴吧自动签到
[Python] 纯文本查看 复制代码import datetime
import os
import re
import requests
import bs4
# 获取关注的所有贴吧链接
def get_tieba_link():
url = 'http://tieba.baidu.com/f/like/mylike?&pn='
page = 1
links = []
while True:
response = requests.get(url + str(page), headers=headers)
bs = bs4.BeautifulSoup(response.text, 'lxml')
for a in bs.select('table tr>td:first-child>a'):
links.append({'href': a.get('href'), 'name': a.string})
if '下一页' not in str(bs):
break
page += 1
return links
# 从贴吧链接中获取贴吧签到参数
def tieba_batch_sign():
links = get_tieba_link()
for link in links:
response = requests.get('https://tieba.baidu.com/' + link['href'], headers=headers)
tbs_reg = re.compile(r'\'tbs\':\s"(.*?)"')
tbs = tbs_reg.search(response.text).group(1)
if not tbs: # 如果tbs不存在则跳过本次循环
continue
param = {'ie': 'utf-8', 'kw': link['name'], 'tbs': tbs}
response = requests.post('https://tieba.baidu.com/sign/add', data=param, headers=headers)
result = response.json()
if result['no'] == 0:
msg = str(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ' ' + link['name'] + ' 签到成功\n'
else:
msg = str(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ' ' + link['name'] + ' ' + result[
'error'] + '\n'
print(msg)
with open(os.path.join(os.getcwd(), 'sign.log'), 'a+') as loghandle:
loghandle.write(msg)
if __name__ == '__main__':
headers = {
'cookie': 'xxxxxxxxxxxx'
}
tieba_batch_sign()
python论坛签到_Python 百度贴吧自动签到相关推荐
- python脚本自动qq签到_python实现虾米音乐自动签到脚本
初学python以及编程,尝试写这样一个脚本,待成功后才会继续完善. 现在想要实现登陆. 问题: 请问我这个代码哪儿出了问题?登陆不成功. headers和postData要写哪些出来,我用HttpF ...
- Github Actions - 实现百度贴吧自动签到
声明:本文章参考 ghosx 的 tieba 代码仓库. 希望我的文章能给你带来帮助. 欢迎访问我的个人博客:codeupbetter.com,学习各种好玩的知识. 文章首更于个人博客,个人博客的排版 ...
- nodejs 版利用 github actions 进行百度贴吧自动签到
nodejs + github actions 实现百度贴吧自动签到 前段时间想用云函数的方式进行百度贴吧的签到,无奈云函数的超时时间最多只能为60秒,还没开始签就结束了,所以就改用了 github ...
- python脚本实例手机端-手机APP自动签到-python实现 - 运维之路
当今是移动APP的天下,很多APP软件为了吸引客户每天登录使用,设置的有每天签到送一些奖励的活动.这里以一个挺火的网络电话软件呼应(每天签到送长)为例,通过python 实现自动签到. 一.Fiddl ...
- python腾讯课堂自动签到_腾讯课堂自动签到,可视化签到结果
// ==UserScript== // @name 腾讯课堂自动签到,可视化签到结果 // @namespace http://tampermonkey.net/ // @version 1.0 / ...
- python答题搜索_python实现百万答题自动百度搜索答案
用python搭建百万答题.自动百度搜索答案. 使用平台 windows7 python3.6 MIX2手机 代码原理 手机屏幕内容同步到pc端 对问题截图 对截图文字分析 用浏览器自动搜索文本 使用 ...
- python+selenium百度贴吧自动签到
#-*- coding:utf-8 -*- from selenium import webdriver import time import os import random from seleni ...
- python之百度贴吧自动签到
# -*- coding: utf-8 -*- '''#百度错误代码: err_code:40 请输入验证码完成发帖 ''' import urllib,urllib2,cookielib,re; i ...
- python京东自动签到_python 使用selenium登陆京东签到哪京豆
[Python] 纯文本查看 复制代码#coding:utf8 from selenium import webdriver import time def sign_up(): url = r'ht ...
- python 百度文库 签到_Python百度文库爬虫终极版
百度文库爬虫 我们在开始爬虫之前,首先要了解网页的信息和结构,然后获取请求的url和参数(payloads)来得到所要的数据并处理.接下来我们根据: 一.网页分析 二.爬虫编写 三.运行与结果 四.程 ...
最新文章
- poj1466(二分图最大独立集)
- JS操作Excel读取和写入(模板操作)
- 阿里云 docker php mysql_PHP开发环境02 - 阿里云Ubuntu使用Docker配置PHP环境(只限于学习)...
- Lc1013将数组分成相等的三个部分
- Python进阶(十三) os、random、time等标准库
- 一份招聘需求的分析 (转载)
- 来听大师讲设计(中)
- 2018第九届蓝桥杯C++省赛B组题目汇总
- 解决电脑因System进程而变得很卡
- TP5整合阿里云OSS上传文件第二节,异步上传头像实现,
- 利用-flat.vmdk文件恢复虚拟机
- 可以叫板Google的一个搜索引擎——DuckDuckGo
- 千锋python培训班怎么样
- 如何在Office 365中使用Office剪贴板?
- java文件输入输出
- [文本纠错] pycorrector框架训练
- Latex加批注 更改
- Mybatis学习 association关联 和 collection集合
- PHP Class SoapClient not found解决方法
- 360网站卫士的IP段添加进服务器的白名单中
热门文章
- vue项目IE浏览器中打不开,为空白页
- css vw vh ie9,css3中calc、vw、vh、vmin、vmax 属性的应用及兼容性详解
- 班主任直接把奖学金名额给了我?就因为我用Python给她写了一个自动阅卷脚本
- 给div添加蒙版(遮罩?)
- 有趣的Javascript:只需一个JS让万恶的IE5、IE6、IE7、IE8全都支持H5原生Canvas绘图(有演示demo)
- 淘宝客淘宝联盟解析二合一链接获取优惠链接还原二合一,提取优惠信息
- 越狱有什么好处?越狱的优点和缺点
- 如何用C#做一个投票小demo
- 物理不好适合学计算机,理科女物理不好、数学一般,能不能学计算机、经济学专业?...
- 页眉怎样从特定的一页开始以及word页眉页脚第几页共几页格式设置