python 3.9
每10个磁链一组,磁链放在Magnet File中
import requests
import time
import os
my_headers = {
‘Accept’: ‘text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9’,
‘User-Agent’: ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36’,
‘Host’: ‘itorrents.org’,
‘Upgrade-Insecure-Requests’: ‘1’
}
while True:
if os.path.getsize(‘Magnet File’) > 0:
with open(‘Magnet File’, ‘r+’) as fp:
hashIDs = fp.readlines()
i = 0
while i < 10:
hashID = hashIDs[i][:-1]
tfURL = f’http://itorrents.org/torrent/{hashID}.torrent’
with open(tfFile, mode=‘wb’) as f:
f.write(requests.get(url=tfURL, headers=my_headers, timeout=30).content)
time.sleep(1)
i = i + 1
fp.seek(0)
fp.truncate()
for number, line in enumerate(hashIDs):
if number not in range(0, i):
fp.write(line)
fp.close()
else:
break
排版有问题,凑乎看吧
提高元数据获取成功率——【元数据链接生成器】
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_LINES 1000
#define MAX_LENGTH 1000
int main() {
char lines[MAX_LINES][MAX_LENGTH]; // 存储输入的文本
int line_count = 0; // 已输入的行数
char output_text[MAX_LINES * MAX_LENGTH] = {0}; // 保存输出结果的文本
// 读入多行文本
printf("元数据链接生成器(QQ群:744839595)\n\n\n\n提示1:复制特征码v1的方法:在比特彗星里选中(1个或多个)任务→右键点击所选任务→点击“复制”→点击“特征码v1”;\n\n提示2:一次性最多可输入1000行特征码;\n\n提示3:特征码输入完毕后,再输入end并回车,即可生成元数据链接。\n\n\n\n请粘贴特征码v1:\n\n");
while (1) {
fgets(lines[line_count], MAX_LENGTH, stdin);
if (strcmp(lines[line_count], "end\n") == 0) {
break;
}
line_count++;
if (line_count >= MAX_LINES) {
printf("Input limit reached\n");
return 1;
}
}
// 清空文本框并刷新缓冲区
system("cls");
fflush(stdout);
// 格式化输出每一行
for (int i = 0; i < line_count; i++) {
// 去除输入行末尾的换行符
int len = strlen(lines[i]);
if (lines[i][len - 1] == '\n') {
lines[i][len - 1] = '\0';
}
// 格式化输出到文本框
printf("http://itorrents.org/torrent/%s.torrent\n", lines[i]);
// 将输出结果拼接到保存输出结果的文本中
strcat(output_text, "http://itorrents.org/torrent/");
strcat(output_text, lines[i]);
strcat(output_text, ".torrent\n");
}
// 将输出结果保存到剪贴板
if (OpenClipboard(NULL)) {
EmptyClipboard();
HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(output_text) + 1);
char *buffer = (char*)GlobalLock(clipbuffer);
strcpy(buffer, output_text);
GlobalUnlock(clipbuffer);
SetClipboardData(CF_TEXT, clipbuffer);
CloseClipboard();
printf("\n元数据链接生成完毕!\n\n已自动保存到剪贴板!请粘贴到比特彗星的磁链框,进行元数据获取!\n\n");
} else {
printf("\n无法打开剪贴板!\n\n请手动复制粘贴以上链接到比特彗星的磁链框,进行元数据获取!\n\n");
}
// 暂停窗口的关闭,等待用户按下任意键
system("pause");
return 0;
}
编译成品:【 https://torrnet.lanzout.com/b0db8z4fc 】