lee1080 / CloudflareSpeedTestDDNS

使用CloudflareSpeedTest工具优选IP后自动DDNS到Cloudflare
464 stars 158 forks source link

反向代理列表线路2无法使用 #65

Open mai1202 opened 7 months ago

mai1202 commented 7 months ago

访问 https://cf.vbar.fun/zip_baipiao_eu_org/pr_ip.txt 返回空值,程序无法正常运行。

mai1202 commented 7 months ago

可以用这个 Python 脚本自己生成 pr_ip.txt。

部署到服务器上,设置定时任务每天运行,然后将 ./cf_ddns/cf_ddns_cloudflare.sh 中第 95 行的https://cf.vbar.fun/zip_baipiao_eu_org/pr_ip.txt替换成自己的网址即可。

import requests
import zipfile
import os
import requests
import shutil

def download_and_extract():
    # Step 1: Download the zip file
    url = "https://zip.baipiao.eu.org/"
    response = requests.get(url)
    zip_file_path = "reversedIp.zip"

    with open(zip_file_path, "wb") as file:
        file.write(response.content)

    # Step 2: Extract the files from the zip
    extracted_files_dir = "./extracted_files/"
    os.makedirs(extracted_files_dir, exist_ok=True)

    with zipfile.ZipFile(zip_file_path, "r") as zip_ref:
        zip_ref.extractall(extracted_files_dir)

    # Step 3: Combine the text files into one file
    combined_file_path = "pr_ip.txt"

    with open(combined_file_path, "w") as combined_file:
        for root, dirs, files in os.walk(extracted_files_dir):
            for file in files:
                if file.endswith(".txt"):
                    file_path = os.path.join(root, file)
                    if "-80." in file or "-443." in file:
                        print(file, file_path)
                        with open(file_path, "r") as txt_file:
                            combined_file.write(txt_file.read())

# Run the task once at the beginning
download_and_extract()
mai1202 commented 7 months ago

https://github.com/mai1202/proxyIPsGetter