欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 资讯 > PT站点自动签到

PT站点自动签到

2025/1/31 6:01:47 来源:https://blog.csdn.net/cfl997/article/details/145398452  浏览:    关键词:PT站点自动签到

在站点下载一些视频电影资源,站点需要长期维护,每天自动签到。

两种方式:

一、保持浏览器登录状态,打开默认用户文件, 模拟点击签到(点击按钮自行设置:根据href名称) log日志 首次配置文件,后续不用再填写

二、打开浏览器网页用油猴自动签到

第一种地址:

自动打开网页点击PT站点签到 | 曹福磊 | Caofulei Blog

第二种:

import os
import schedule
import time
import sys
import configparser
import datetime
import threading
import subprocess
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QLineEdit, QPushButton, QVBoxLayout, QHBoxLayout, QTimeEdit, QTextEdit
from PyQt5.QtCore import QTimeCONFIG_FILE = "config.ini"def open_edge(url):subprocess.Popen(['start', 'msedge', url], shell=True)def close_edge():subprocess.call(['taskkill', '/f', '/im', 'msedge.exe'])def job(urls):for url in urls:open_edge(url)time.sleep(600)  # 等待10分钟close_edge()def schedule_job(hour, minute, urls):schedule.clear()  # 清除之前的任务schedule.every().day.at(f"{hour:02d}:{minute:02d}").do(job, urls)print(f"Scheduled job at {hour:02d}:{minute:02d} for URLs: {', '.join(urls)}")def start_scheduler():while True:schedule.run_pending()time.sleep(1)def load_config():config = configparser.ConfigParser()config.read(CONFIG_FILE)if 'settings' in config:urls = config['settings'].get('urls', '').split('\n')time_str = config['settings'].get('time', '08:00')hour, minute = map(int, time_str.split(':'))return urls, QTime(hour, minute)return [], QTime.currentTime()def save_config(urls, time):config = configparser.ConfigParser()config['settings'] = {'urls': '\n'.join(urls),'time': time.toString('HH:mm')}with open(CONFIG_FILE, 'w') as configfile:config.write(configfile)class SchedulerApp(QWidget):def __init__(self):super().__init__()self.initUI()def initUI(self):self.setWindowTitle('定时网页打开器')self.setGeometry(100, 100, 600, 300)layout = QVBoxLayout()time_layout = QHBoxLayout()time_label = QLabel('每天执行时间:')self.time_edit = QTimeEdit()self.time_edit.setDisplayFormat('HH:mm')urls, time = load_config()self.time_edit.setTime(time)time_layout.addWidget(time_label)time_layout.addWidget(self.time_edit)layout.addLayout(time_layout)url_layout = QHBoxLayout()url_label = QLabel('网页链接 (每行一个):')self.url_edit = QTextEdit()self.url_edit.setText('\n'.join(urls))url_layout.addWidget(url_label)url_layout.addWidget(self.url_edit)layout.addLayout(url_layout)submit_button = QPushButton('提交')submit_button.clicked.connect(self.on_submit)layout.addWidget(submit_button)self.setLayout(layout)def on_submit(self):time = self.time_edit.time()hour = time.hour()minute = time.minute()urls = self.url_edit.toPlainText().split('\n')schedule_job(hour, minute, urls)save_config(urls, time)if __name__ == "__main__":app = QApplication(sys.argv)ex = SchedulerApp()ex.show()scheduler_thread = threading.Thread(target=start_scheduler, daemon=True)scheduler_thread.start()sys.exit(app.exec_())

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com