diff --git a/PT/pt_config.toml b/PT/pt_config.toml index c292883..daf87d6 100644 --- a/PT/pt_config.toml +++ b/PT/pt_config.toml @@ -60,26 +60,23 @@ url = "https://1ptba.com" cookie = "c_secure_uid=MTA0ODQx; c_secure_pass=c32037fc1a670e75d797df403e9e5a33; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D" level = 3 label = "游戏、综艺、电子书、windows软件" -flag = 1 -[icc2022] +['icc2022'] url = "https://www.icc2022.com" cookie = "c_secure_uid=MTk0OTI%3D; c_secure_pass=d7f655d5b8e90739f23620b9d24241e1; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D; PHPSESSID=em8dtq7r0t77tt1e0aq4m0of1o" level = 3 label = "动漫、综艺、电视剧" -flag = 1 # ===========================【end】 nastools 合作站点 【end】=========================== # ===========================【start】 9kg 站点 【start】=========================== -[pttime] +['pttime'] url = "https://www.pttime.org" cookie = "c_lang_folder=chs; c_secure_uid=OTExNDU%3D; c_secure_pass=b4567a9950c3906657ed8baeb5a39b2d; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D; cf_clearance=RtffM86J.2AMKNqMKcF5WTGWOK11V7gklzY2rDRNu24-1701826018-0-1-d71c894c.1d67b4d8.801dd6ac-0.2.1701826018" level = 2 label = "9kg" -flag = 1 -[2xfree] +['2xfree'] url = "https://pt.2xfree.org" cookie = "" level = 2 @@ -208,7 +205,7 @@ cookie = "" level = 3 label = "影视,有声书,音乐,综合" -[btschool] +['btschool'] url = "https://pt.btschool.club" cookie = "cf_clearance=jF00JzyDrgabpWNeI.lugDevna4ve32DaZmrQRdaCT0-1704082342-0-2-a3ff971.dfaafd78.5d3ea691-150.0.0; c_secure_uid=MTM4NTQ2; c_secure_pass=8ecd3e82fe5489fac4d6cda2a9ba1839; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D" attendance_uri = "/index.php?action=addbonus" diff --git a/PT/pt_operation.py b/PT/pt_operation.py index 6918780..eac33ab 100644 --- a/PT/pt_operation.py +++ b/PT/pt_operation.py @@ -152,9 +152,9 @@ class PtOperation: config_data = toml.load(file) # 迭代每个 section for section_name, section_data in config_data.items(): - print(f"Processing section: {section_name} --- {section_data.get('url')}") url, cookie, flag = section_data.get('url'), section_data.get('cookie'), section_data.get('flag') if flag != 1: + print(f"Processing section: {section_name} --- {section_data.get('url')}") # 签到 self.attendances(section_name, section_data) # 检测是否可以注册 @@ -164,6 +164,3 @@ class PtOperation: except toml.TomlDecodeError as e: print(f"Error decoding TOML: {e}") - -if __name__ == '__main__': - PtOperation().signup("icc2022", "https://www.icc2022.com") diff --git a/PT/test.html b/PT/test.html deleted file mode 100644 index c409282..0000000 --- a/PT/test.html +++ /dev/null @@ -1,159 +0,0 @@ - - ..
- - - - - - - -
-
- - - - - - -
-
.
-
-

.

-

.

- - - - - - - - - - - - - - - - - - - - - - - - -
类型 - 标题 - - - comments - - - - time - - - - size - - - - seeders - - - - leechers - - - - snatched - - - 发布者 -
- - 电影/Movies - - encode - - - - - - - -
- Sticky -   - - The Man in the Iron Mask 1998 Blu-ray 1080p x264 DTS-HD MA 5.1-BtsHD - - - [热门 - ] - - Free - ( - - 剩余时间:3天7时 - - ) -
- 官方 - 铁面人 -
- -
-
-
-
-
-
- 豆瓣评分  无 -
-
- IMDB评分  无 -
-
- - download - -
- - Unbookmarked - -
-
- 0 - - - 1天 -
16时 -
-
- 11.17 -
GB -
- - 123 - - - - 2 - - - - 246 - - - 匿名 -
-

.

-
-
-
- - \ No newline at end of file diff --git a/PT/test.py b/PT/test.py index 187b5ac..e69de29 100644 --- a/PT/test.py +++ b/PT/test.py @@ -1,139 +0,0 @@ -import time -from datetime import datetime - -import pandas as pd -import requests -import sqlalchemy -import toml -from lxml import html as lhtml -from urllib.parse import urlparse, parse_qs -from sqlalchemy.orm import attributes -from sqlalchemy import func - -from qnloft_db.sqlite_db_main import SqliteDbMain -from qnloft_db_model.PtWebsiteData import PtWebsiteData -from dateutil import parser -from qnloft_db import db_config as config -def extract_id(url, field) -> bytes: - parsed_url = urlparse(url) - query_params = parse_qs(parsed_url.query) - return query_params.get(field, [None])[0] - - -def contains_alpha_or_chinese(input_str): - s = input_str.strip() - # 判断是否包含字母 - has_alpha = any(char.isalpha() for char in s) - # 判断是否包含汉字 - has_chinese = any('\u4e00' <= char <= '\u9fff' for char in s) - # 返回结果 - return s if has_alpha or has_chinese else None - - -def check_seed_status(status): - s = ["%", "Free", "free"] - return status if any(keyword in status for keyword in s) else None - - -headers = { - 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'accept-language': 'zh,zh-CN;q=0.9', - 'cache-control': 'max-age=0', - 'sec-ch-ua': '"Google Chrome";v="119", "Chromium";v="119", "Not?A_Brand";v="24"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"macOS"', - 'sec-fetch-dest': 'document', - 'sec-fetch-mode': 'navigate', - 'sec-fetch-site': 'same-origin', - 'sec-fetch-user': '?1', - 'upgrade-insecure-requests': '1', - 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36', -} -section_name = 'icc2022' -# cookie = "c_secure_uid=MTk0OTI%3D; c_secure_pass=d7f655d5b8e90739f23620b9d24241e1; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D; PHPSESSID=em8dtq7r0t77tt1e0aq4m0of1o" -# url = "https://www.icc2022.com" -# url = "https://1ptba.com" -# cookie = "c_secure_uid=MTA0ODQx; c_secure_pass=c32037fc1a670e75d797df403e9e5a33; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D" -url = "https://pt.btschool.club" -cookie = "cf_clearance=jF00JzyDrgabpWNeI.lugDevna4ve32DaZmrQRdaCT0-1704082342-0-2-a3ff971.dfaafd78.5d3ea691-150.0.0; c_secure_uid=MTM4NTQ2; c_secure_pass=8ecd3e82fe5489fac4d6cda2a9ba1839; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D" -# url = "https://www.pttime.org" -# cookie = "c_lang_folder=chs; c_secure_uid=OTExNDU%3D; c_secure_pass=b4567a9950c3906657ed8baeb5a39b2d; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D; cf_clearance=RtffM86J.2AMKNqMKcF5WTGWOK11V7gklzY2rDRNu24-1701826018-0-1-d71c894c.1d67b4d8.801dd6ac-0.2.1701826018" -headers["cookie"] = cookie -url = url + "/torrents.php" -html = "" -# for _ in range(5): -# try: -# response = requests.get(url, headers=headers, timeout=5 * 60) -# if response.status_code == 200: -# html = response.text -# break -# else: -# print(f"{section_name} , 出现错误,code码是:{response.status_code}, {response.text}!!!") -# break -# except Exception as e: -# time.sleep(2) -# else: -# print(f"{section_name} , 5次出现错误,无法访问!!!") -# with open('test.html', 'r', encoding='utf-8') as file: -# html = file.read() -# print(html) -# doc_html = lhtml.fromstring(html) -# page_href = doc_html.xpath('//td[@class="embedded"]//p[@align="center"][1]//a[last()]/@href')[0] -# pages_str = extract_id(page_href, "page") -# pages = int(pages_str) if pages_str.isdigit() else 0 -# for i in range(0, pages): -# print(i) - -# 查询数据库表的结构信息 -columns = PtWebsiteData.__table__.columns.keys() - -# 使用列名创建一个包含空值的字典 -data = {col: [] for col in columns} - -# 创建空 DataFrame -df = pd.DataFrame(data) - -db_main = SqliteDbMain(config.pt_website_db) -count = db_main.pandas_query_by_condition( - model=func.count(PtWebsiteData.id), - query_condition=PtWebsiteData.source_name == "1PTBar/壹PT", -) -print(int(count['count_1'].iloc[0])) - - -""" -主键id,pt资源id,来源名称,一级标题,二级标题,分类id,分类名称 -种子状态,状态剩余时间,做种状态,评论数,资源上传时间,资源大小, -做种数,下载数,完成数,发布者,豆瓣评分,IMDB评分,下载链接,详情链接 -CREATE TABLE IF NOT EXISTS pt_website_data ( - id INTEGER PRIMARY KEY, - pt_id INTEGER, - source_name TEXT NOT NULL, - first_title TEXT NOT NULL, - second_title TEXT NOT NULL, - type_id INTEGER, - type_name TEXT, - seed_status TEXT, - status_remaining_time TEXT, - seeding_status TEXT, - comment_count INTEGER, - upload_time TEXT, - size TEXT, - seed_count INTEGER, - download_count INTEGER, - completion_count INTEGER, - publisher TEXT, - douban_rating REAL, - imdb_rating REAL, - download_link TEXT, - details_link TEXT, - UNIQUE(pt_id , source_name) -); - -CREATE TABLE IF NOT EXISTS pt_website_type ( - id INTEGER PRIMARY KEY, - source_name TEXT NOT NULL, - type_name TEXT NOT NULL, - type_url TEXT NOT NULL -); -""" diff --git a/junit/__init__.py b/junit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/junit/pt_operation_junit.py b/junit/pt_operation_junit.py new file mode 100644 index 0000000..ad9f454 --- /dev/null +++ b/junit/pt_operation_junit.py @@ -0,0 +1,27 @@ +import toml + +from PT.pt_operation import PtOperation + + +def attendances_junit(name): + with open('../PT/pt_config.toml', 'r', encoding='utf-8') as file: + config_data = toml.load(file) + # 迭代每个 section + for section_name, section_data in config_data.items(): + print(f"Processing section: {section_name} --- {section_data.get('url')}") + if name == section_name: + PtOperation().attendances(section_name, section_data) + + +def signup_junit(name): + with open('../PT/pt_config.toml', 'r', encoding='utf-8') as file: + config_data = toml.load(file) + # 迭代每个 section + for section_name, section_data in config_data.items(): + print(f"Processing section: {section_name} --- {section_data.get('url')}") + if name == section_name: + PtOperation().signup(section_name, section_data) + + +# attendances_junit("icc2022") +signup_junit("1PTBar/壹PT")