Skip to content

Commit

Permalink
Update result.csv and ip.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
laityts committed Jan 4, 2025
1 parent 32383db commit 10ac7cd
Show file tree
Hide file tree
Showing 6 changed files with 320 additions and 282 deletions.
40 changes: 20 additions & 20 deletions cfip/ip.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
104.17.167.137#US
190.93.245.76#US
104.19.217.96#US
104.16.1.30#US
104.18.154.248#US
104.17.185.253#US
104.16.8.212#US
104.16.151.142#US
104.17.134.248#US
104.18.72.169#US
104.16.0.231#US
104.18.177.194#US
104.17.206.162#US
104.25.242.134#US
104.18.64.99#US
104.25.249.12#US
104.18.146.166#US
104.16.9.15#US
104.18.155.154#US
104.17.195.198#US
104.18.158.19#US
104.18.185.247#US
104.17.203.250#US
104.18.69.44#US
104.17.128.166#US
104.16.8.122#US
104.17.198.142#US
104.18.149.224#US
104.17.139.210#US
104.25.243.205#US
104.17.196.172#US
104.18.64.29#US
104.25.249.17#US
104.17.134.90#US
104.18.150.213#US
104.18.171.136#US
104.18.39.165#US
104.17.194.101#US
104.19.212.23#US
104.17.137.153#US
12 changes: 6 additions & 6 deletions cfst.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ def get_country(ip_address):
with open(proxy_txt, mode="a", encoding="utf-8") as proxy_file:
proxy_file.write(f"{ip_address}#{emoji}{country}{str(random_port)}\n")

# 返回 country 和 proxyip
return country, proxyip
# 返回 country
return f"{country}"
else:
print(f"主 API 请求失败,IP {ip_address} 状态码: {response.status_code}")
except requests.exceptions.RequestException as e:
Expand All @@ -155,7 +155,7 @@ def get_country(ip_address):
# 提取国家代码
country = data.get('country', 'CF优选')
# 备用 API 没有 proxyip 信息,默认返回 False
return country, False
return f"{country}"
else:
print(f"备用 API 请求失败,IP {ip_address} 状态码: {response.status_code}")
except requests.exceptions.RequestException as e:
Expand All @@ -165,7 +165,7 @@ def get_country(ip_address):
time.sleep(2)

# 默认返回值
return "CF优选", False
return "CF优选"

# ------------------------------
# 主程序逻辑
Expand Down Expand Up @@ -229,9 +229,9 @@ def get_country(ip_address):
# 将 IP 地址和 country 信息写入 ip.txt
with open(output_txt, mode="w", encoding="utf-8") as txtfile:
for ip, speed in zip(ip_addresses, download_speeds):
country, proxyip = get_country(ip) # 接收 country 和 proxyip
country = get_country(ip) # 接收 country 和 proxyip
txtfile.write(f"{ip}#{country}\n")
print(f"IP: {ip}, Country: {country}, ProxyIP: {proxyip}")
print(f"IP: {ip}, Country: {country}")

print(f"提取的 IP 地址和 country 信息已保存到 {output_txt}")

Expand Down
40 changes: 20 additions & 20 deletions csv/result.csv
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
IP 地址,已发送,已接收,丢包率,平均延迟,下载速度 (MB/s)
104.17.167.137,4,4,0.00,109.32,7.20
190.93.245.76,4,4,0.00,31.43,7.10
104.19.217.96,4,4,0.00,25.96,7.03
104.16.1.30,4,4,0.00,25.25,6.86
104.18.154.248,4,4,0.00,31.02,6.79
104.17.185.253,4,4,0.00,109.23,6.74
104.16.8.212,4,4,0.00,30.89,6.62
104.16.151.142,4,4,0.00,109.04,6.62
104.17.134.248,4,4,0.00,31.48,6.47
104.18.72.169,4,4,0.00,31.09,6.38
104.16.0.231,4,4,0.00,24.66,6.26
104.18.177.194,4,4,0.00,30.86,6.17
104.17.206.162,4,4,0.00,31.30,6.16
104.25.242.134,4,4,0.00,31.28,5.83
104.18.64.99,4,4,0.00,30.53,5.80
104.25.249.12,4,4,0.00,31.17,5.73
104.18.146.166,4,4,0.00,30.37,5.61
104.16.9.15,4,4,0.00,31.25,5.59
104.18.155.154,4,4,0.00,31.00,5.59
104.17.195.198,4,4,0.00,30.77,5.23
104.18.158.19,4,4,0.00,72.19,7.83
104.18.185.247,4,4,0.00,70.64,7.75
104.17.203.250,4,4,0.00,65.63,7.49
104.18.69.44,4,4,0.00,42.04,7.38
104.17.128.166,4,4,0.00,68.68,7.35
104.16.8.122,4,4,0.00,63.13,7.24
104.17.198.142,4,4,0.00,69.43,7.21
104.18.149.224,4,4,0.00,40.20,7.06
104.17.139.210,4,4,0.00,39.24,7.05
104.25.243.205,4,4,0.00,64.17,6.95
104.17.196.172,4,4,0.00,41.74,6.95
104.18.64.29,4,4,0.00,40.38,6.87
104.25.249.17,4,4,0.00,63.96,6.83
104.17.134.90,4,4,0.00,71.56,6.76
104.18.150.213,4,4,0.00,39.23,6.69
104.18.171.136,4,4,0.00,63.35,6.63
104.18.39.165,4,4,0.00,75.47,6.19
104.17.194.101,4,4,0.00,40.86,5.78
104.19.212.23,4,4,0.00,41.48,5.54
104.17.137.153,4,4,0.00,41.29,4.79
Loading

0 comments on commit 10ac7cd

Please sign in to comment.