|
@@ -1,6 +1,5 @@
|
|
|
import requests
|
|
import requests
|
|
|
from time import sleep
|
|
from time import sleep
|
|
|
-import random
|
|
|
|
|
import time
|
|
import time
|
|
|
import os
|
|
import os
|
|
|
import re
|
|
import re
|
|
@@ -8,15 +7,10 @@ import sys
|
|
|
from datetime import datetime, timezone, timedelta
|
|
from datetime import datetime, timezone, timedelta
|
|
|
from retry import retry
|
|
from retry import retry
|
|
|
import socket
|
|
import socket
|
|
|
-import asyncio
|
|
|
|
|
-import aiohttp
|
|
|
|
|
|
|
|
|
|
# 原始脚本地址: https://github.com/cnwikee/CheckTMDB.git
|
|
# 原始脚本地址: https://github.com/cnwikee/CheckTMDB.git
|
|
|
|
|
|
|
|
-country_code = 'jp' # 节点
|
|
|
|
|
-
|
|
|
|
|
DOMAINS = [
|
|
DOMAINS = [
|
|
|
- 'dns.google',
|
|
|
|
|
'tmdb.org',
|
|
'tmdb.org',
|
|
|
'api.tmdb.org',
|
|
'api.tmdb.org',
|
|
|
'files.tmdb.org',
|
|
'files.tmdb.org',
|
|
@@ -55,8 +49,6 @@ def write_host_file(file_path: str, hosts_content: str, filename: str) -> None:
|
|
|
output_fb.write(hosts_content)
|
|
output_fb.write(hosts_content)
|
|
|
print(f"\n~最新{filename}地址已更新~")
|
|
print(f"\n~最新{filename}地址已更新~")
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
def ping_ip(ip, port=80):
|
|
def ping_ip(ip, port=80):
|
|
|
print(f"使用TCP连接测试IP地址的延迟(毫秒)")
|
|
print(f"使用TCP连接测试IP地址的延迟(毫秒)")
|
|
|
try:
|
|
try:
|
|
@@ -153,14 +145,14 @@ def get_domain_ips(domain, record_type):
|
|
|
all_ips = [] # 存储所有DNS服务器返回的IP
|
|
all_ips = [] # 存储所有DNS服务器返回的IP
|
|
|
|
|
|
|
|
print(f"正在从Google DNS获取 {domain} 的{record_type}记录...")
|
|
print(f"正在从Google DNS获取 {domain} 的{record_type}记录...")
|
|
|
- url = f'https://dns.google/resolve'
|
|
|
|
|
|
|
+ url = f'https://cloudflare-dns.com/dns-query'
|
|
|
headers = {
|
|
headers = {
|
|
|
- "accept": "*/*",
|
|
|
|
|
- "accept-encoding": "gzip, deflate, br, zstd",
|
|
|
|
|
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
|
|
|
- "content-type": "application/json; charset=UTF-8", # 关键:指定JSON格式负载
|
|
|
|
|
- "referer": f"https://dns.google/query?name={domain}&rr_type={record_type}&ecs=",
|
|
|
|
|
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0"
|
|
|
|
|
|
|
+ "accept": "application/dns-json"
|
|
|
|
|
+ # "accept-encoding": "gzip, deflate, br, zstd",
|
|
|
|
|
+ # "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
|
|
|
+ # "content-type": "application/json; charset=UTF-8", # 关键:指定JSON格式负载
|
|
|
|
|
+ # "referer": f"https://dns.google/query?name={domain}&rr_type={record_type}&ecs=",
|
|
|
|
|
+ # "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
params = {
|
|
params = {
|