Repository: ZeroSimple/MicrosoftHostsPicker
Branch: main
Commit: 8eb8643d154e
Files: 19
Total size: 27.1 KB
Directory structure:
gitextract_xfih8thy/
├── .gitignore
├── LICENSE
├── MicrosoftHostsPicker.py
├── README.md
├── data/
│ ├── Microsoft_Account.txt
│ ├── Microsoft_Games_Download.txt
│ ├── Microsoft_Login.txt
│ ├── Microsoft_Store_Images.txt
│ ├── Microsoft_Store_Pages.txt
│ ├── Office_CDN.txt
│ ├── OneNote.txt
│ ├── Windows_Update.txt
│ ├── Xbox_Cloud_Sync.txt
│ ├── Xbox_Live_CDN_1.txt
│ └── Xbox_Live_CDN_2.txt
├── index.html
├── requirements.txt
├── script.js
└── style.css
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
hosts
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2021 Konnyaku
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: MicrosoftHostsPicker.py
================================================
import concurrent.futures
from typing import List, Tuple
from ping3 import ping
def ping_ip(ip: str, attempts: int = 3, timeout: float = 1.0) -> float:
total_time = 0.0
for _ in range(attempts):
ping_time = ping(ip, timeout=timeout, unit='ms')
if ping_time is None:
return float('inf')
total_time += ping_time
return total_time / attempts
def process_ip_list(file_path: str) -> Tuple[str, float]:
best_ip = ''
best_time = float('inf')
with open(file_path, 'r') as file:
for ip in file:
ip = ip.strip()
avg_time = ping_ip(ip)
if avg_time < best_time:
best_ip = ip
best_time = avg_time
return best_ip, best_time
def write_hosts_section(hosts_file, title: str, ip: str, domains: List[str]):
hosts_file.write(f'# {title}\n')
for domain in domains:
hosts_file.write(f'{ip} {domain}\n')
hosts_file.write('\n')
def main():
ip_files = {
'Microsoft_Account': './data/Microsoft_Account.txt',
'Xbox_Live_CDN_1': './data/Xbox_Live_CDN_1.txt',
'Xbox_Live_CDN_2': './data/Xbox_Live_CDN_2.txt',
'Xbox_Cloud_Sync': './data/Xbox_Cloud_Sync.txt',
'Office_CDN': './data/Office_CDN.txt',
'Microsoft_Store_Images': './data/Microsoft_Store_Images.txt',
'Microsoft_Store_Pages': './data/Microsoft_Store_Pages.txt',
'Microsoft_Games_Download': './data/Microsoft_Games_Download.txt',
'Windows_Update': './data/Windows_Update.txt',
}
with concurrent.futures.ThreadPoolExecutor() as executor:
future_to_file = {executor.submit(process_ip_list, file_path): file_name
for file_name, file_path in ip_files.items()}
results = {}
for future in concurrent.futures.as_completed(future_to_file):
file_name = future_to_file[future]
ip, time = future.result()
results[file_name] = ip
print(f"{file_name}: {ip} ({time:.2f}ms)")
with open("hosts", 'w') as hosts:
# OneDrive Hosts beta
write_hosts_section(hosts, 'OneDrive (Beta, only for China)', '',
['134.170.108.26 onedrive.live.com',
'134.170.109.48 skyapi.onedrive.live.com'])
# Microsoft Login Hosts
write_hosts_section(hosts, 'Microsoft Login', '13.107.42.22',
['logincdn.msauth.net', 'login.live.com',
'acctcdn.msauth.net', 'account.live.com'])
write_hosts_section(hosts, 'Microsoft Account', results['Microsoft_Account'],
['account.microsoft.com'])
# Xbox Live CDN
xbox_live_cdn_domains = [
'gameclipscontent-d2009.xboxlive.com', 'images-eds.xboxlive.com',
'xbl-smooth.xboxlive.com', 'titlehub.xboxlive.com', 'compass.xboxlive.com',
'xnotify.xboxlive.com', 'activityhub.xboxlive.com', 'xboxcare.xboxlive.com',
'images-eds-ssl.xboxlive.com', 'rta.xboxlive.com', 'peoplehub.xboxlive.com',
'editorial.xboxlive.com'
]
write_hosts_section(hosts, 'Xbox Live CDN', results['Xbox_Live_CDN_1'], xbox_live_cdn_domains)
write_hosts_section(hosts, 'Xbox Cloud Sync', results['Xbox_Cloud_Sync'],
['titlestorage.xboxlive.com'])
write_hosts_section(hosts, 'Office CDN', results['Office_CDN'],
['officecdn.microsoft.com'])
write_hosts_section(hosts, 'Microsoft Store Images', results['Microsoft_Store_Images'],
['store-images.s-microsoft.com'])
write_hosts_section(hosts, 'Microsoft Store Pages', results['Microsoft_Store_Pages'],
['storeedgefd.dsx.mp.microsoft.com'])
write_hosts_section(hosts, 'Microsoft Games Download', results['Microsoft_Games_Download'],
['xvcf1.xboxlive.com', 'xvcf2.xboxlive.com'])
write_hosts_section(hosts, 'Windows Update', results['Windows_Update'],
['tlu.dl.delivery.mp.microsoft.com', 'dl.delivery.mp.microsoft.com',
'assets1.xboxlive.cn', 'assets2.xboxlive.cn'])
print('All done.')
print('The output Hosts file is in the "hosts" in the same directory as "MicrosoftHostsPicker.py".')
print('Please select the hosts you need to add to your system.')
input('Press Enter to exit...')
if __name__ == '__main__':
main()
================================================
FILE: README.md
================================================
# Microsoft Hosts Picker - M$💊
A lightweight Python script to help you select the fastest IP addresses for Microsoft services.
## Why This Tool?
In certain regions, Microsoft services may not function optimally due to DNS resolving to suboptimal IP addresses. This script aims to address that issue by finding the most responsive IPs for various Microsoft services.
## Getting Started
1. Install dependencies:
```sh
pip install -r requirements.txt
```
2. Download the latest [ZIP](https://github.com/ButaiKirin/MicrosoftHostsPicker/archive/refs/heads/main.zip) from this repository.
3. Extract the contents to your preferred location.
4. Run the script:
```sh
python MicrosoftHostsPicker.py
```
## How It Works
The script automatically selects the best IP addresses for various Microsoft services. Results are saved in a "hosts" file in the same directory as "MicrosoftHostsPicker.py".
## Usage Tips
- Only replace the problematic IP addresses in your system's hosts file.
- Avoid overwriting all entries, as this may cause unintended issues.
- Some services (e.g., Office Download and Windows Update) use global CDN nodes and may not require manual configuration unless your DNS is resolving incorrectly.
Enjoy faster and more reliable access to Microsoft services!
================================================
FILE: data/Microsoft_Account.txt
================================================
23.192.120.51
23.205.249.96
23.43.191.223
184.26.37.234
184.31.41.99
104.126.22.240
23.198.123.197
96.16.0.12
104.102.111.71
104.86.21.130
23.46.242.180
23.14.236.26
104.84.165.78
104.127.2.69
184.25.94.23
2.18.130.30
23.42.218.109
23.42.230.221
23.15.137.62
23.15.106.157
104.93.164.17
23.34.191.223
104.124.19.121
104.74.192.50
23.37.44.103
23.66.151.205
118.215.176.239
184.51.248.236
223.119.244.240
104.120.150.36
173.223.149.80
23.13.246.239
2.17.4.205
23.51.125.60
223.119.207.61
104.95.186.125
96.16.86.245
104.96.8.210
23.65.243.236
23.201.83.137
23.35.168.21
104.66.90.173
23.204.228.173
184.85.152.224
104.116.15.193
184.26.249.105
95.101.198.93
23.6.111.223
104.96.144.219
23.77.13.252
23.50.97.161
23.53.145.30
23.218.131.142
95.100.117.56
23.218.23.32
104.100.19.155
23.4.207.194
2.20.193.168
23.199.129.30
2.19.148.42
23.49.9.213
104.81.220.182
104.75.192.24
23.77.146.110
23.207.137.12
2.19.127.199
88.221.237.163
104.104.169.37
104.88.39.246
104.116.168.170
23.38.253.160
104.122.121.144
23.209.242.51
23.36.213.82
23.15.255.17
23.72.19.230
104.85.76.115
23.13.83.223
104.109.57.10
23.35.91.151
104.97.155.160
104.90.85.49
104.119.206.226
104.85.140.106
23.35.13.41
184.26.196.167
118.215.85.104
23.7.106.187
23.2.136.202
104.83.146.35
104.75.61.196
23.2.55.120
23.210.143.25
104.97.207.211
23.195.220.114
104.120.228.69
23.8.183.228
92.123.47.82
173.223.58.231
104.78.249.230
23.217.234.233
104.98.7.91
173.222.155.126
23.14.168.89
23.202.136.38
184.26.0.215
23.8.221.97
104.112.0.182
96.16.126.74
104.113.184.139
104.84.243.74
23.35.127.223
23.59.206.229
23.47.24.163
23.42.123.61
23.35.45.202
184.87.68.192
104.126.217.217
104.118.45.84
23.78.170.154
23.193.159.124
23.49.121.173
23.202.111.223
104.78.113.145
104.77.224.7
104.98.202.21
104.120.221.30
23.61.73.164
2.18.39.212
23.46.143.223
23.3.238.49
================================================
FILE: data/Microsoft_Games_Download.txt
================================================
23.210.215.81
23.50.57.116
23.210.215.105
23.44.4.234
23.196.11.62
208.185.115.97
92.123.77.74
23.215.190.208
104.117.183.193
2.22.48.27
23.50.49.180
173.222.108.200
173.223.11.144
23.32.241.81
184.25.56.148
23.223.199.137
2.22.119.32
23.40.41.28
88.221.135.74
23.50.49.179
184.50.113.130
69.192.4.67
23.218.80.168
23.32.56.137
96.17.167.19
23.223.57.40
23.220.167.74
104.99.238.42
23.45.112.202
23.0.174.187
2.21.71.90
23.220.167.8
184.84.150.17
92.123.195.99
104.98.3.11
23.45.180.184
23.45.112.200
23.34.247.80
96.17.167.17
23.202.35.75
2.21.34.34
23.45.180.154
23.194.212.97
23.46.16.223
23.40.196.49
23.59.190.139
23.211.108.27
23.40.41.15
184.28.50.147
23.63.245.40
69.192.4.89
104.86.110.242
23.63.245.43
184.28.50.136
2.23.167.98
124.40.41.84
2.23.167.59
23.50.49.186
23.10.252.26
104.86.110.216
23.206.195.56
104.91.69.83
23.32.56.138
139.175.236.106
23.1.237.225
23.205.154.25
104.91.69.11
184.150.58.161
23.205.154.19
23.223.197.16
184.27.123.138
23.215.177.26
23.32.3.106
23.223.57.75
23.76.153.202
23.205.154.27
92.123.77.80
23.219.39.98
23.32.3.122
23.32.238.170
23.205.154.18
================================================
FILE: data/Microsoft_Login.txt
================================================
117.28.245.88
152.199.40.6
13.107.213.49
13.107.246.49
13.107.246.69
13.107.246.38
192.229.211.199
13.107.246.46
192.229.221.185
13.107.246.39
13.107.246.51
13.107.246.47
13.107.246.70
13.107.246.71
13.107.213.36
================================================
FILE: data/Microsoft_Store_Images.txt
================================================
184.25.249.141
23.45.61.216
23.200.153.227
23.45.57.216
23.197.185.151
184.50.93.123
23.44.1.197
23.50.125.135
173.222.235.222
23.57.115.64
88.221.18.124
104.123.205.191
23.2.77.195
23.211.32.13
23.41.209.151
23.201.37.140
184.26.130.76
23.208.65.246
23.199.77.227
184.86.217.156
104.75.165.226
23.60.109.151
96.7.213.143
104.109.241.150
184.27.29.252
23.211.229.236
23.40.37.156
173.222.182.76
104.85.1.135
23.45.134.201
184.30.21.144
96.16.89.156
================================================
FILE: data/Microsoft_Store_Pages.txt
================================================
117.21.204.223
221.230.146.211
60.210.8.160
223.111.105.38
27.148.138.181
182.247.226.216
221.194.157.13
122.224.46.180
23.40.45.233
23.1.246.92
23.55.249.219
104.109.241.212
23.78.218.53
23.51.209.146
23.53.253.100
2.18.233.45
96.16.89.232
104.117.73.212
23.60.109.206
23.45.199.202
96.7.233.218
23.57.113.5
23.48.230.59
23.40.121.232
23.11.189.139
104.85.1.198
================================================
FILE: data/Office_CDN.txt
================================================
112.65.118.99
218.2.0.234
49.79.237.57
221.194.154.121
202.109.143.67
116.207.139.42
49.79.237.56
124.205.198.173
183.134.26.77
122.5.60.150
139.215.144.19
118.182.230.37
49.79.237.43
58.20.137.220
118.182.230.40
218.2.0.236
122.224.44.186
123.244.38.41
49.79.237.48
49.79.237.58
49.79.237.51
118.182.230.36
42.49.13.28
223.111.179.37
117.34.43.54
219.147.109.13
106.117.241.120
118.182.230.55
221.230.144.165
180.97.232.184
49.79.237.45
180.97.232.89
121.22.230.85
180.97.232.186
106.117.241.119
49.79.237.55
124.165.125.32
23.40.44.59
223.111.179.40
117.34.43.53
36.156.46.28
106.117.241.68
36.156.46.30
1.180.21.197
180.97.232.185
120.52.72.63
96.17.188.60
23.200.152.67
23.35.180.91
23.1.244.73
104.119.104.60
23.45.196.159
23.55.248.61
23.38.114.109
104.85.4.56
2.18.232.120
23.48.228.67
23.40.120.59
23.51.208.92
104.109.240.60
96.7.212.56
104.124.16.42
123.184.153.76
120.201.104.55
120.52.72.64
219.147.98.24
111.19.137.73
113.200.41.34
115.238.137.179
183.240.1.59
119.36.245.185
183.134.235.35
36.150.13.157
122.189.224.34
27.148.137.150
183.249.20.48
36.248.21.14
36.150.13.134
112.132.226.44
183.47.233.58
183.134.26.61
218.98.50.41
139.215.146.75
222.220.214.83
120.198.141.120
117.156.133.199
120.52.72.55
221.233.240.57
115.85.200.170
183.134.235.20
120.220.20.115
120.52.72.58
180.97.232.94
183.249.20.62
112.132.226.43
123.184.153.78
184.86.92.59
120.52.72.102
118.182.230.169
101.106.15.15
1.180.18.42
60.163.162.45
119.84.174.124
36.150.13.139
122.189.224.35
119.84.174.121
42.49.13.29
182.106.151.74
36.150.13.133
112.132.226.57
183.134.235.34
36.150.13.135
123.184.153.73
218.60.121.83
115.238.202.204
221.178.101.50
125.44.162.62
118.121.192.156
120.198.141.116
118.182.230.152
221.178.101.53
121.22.230.27
123.184.153.71
120.201.104.56
139.215.145.221
113.96.163.17
120.226.7.37
119.84.174.122
221.178.101.48
113.200.41.36
223.111.173.69
118.182.230.137
60.165.117.51
117.156.133.197
115.85.200.167
================================================
FILE: data/OneNote.txt
================================================
52.109.2.48
52.109.92.45
52.109.132.46
52.109.28.36
52.109.88.148
52.109.44.33
52.109.44.31
52.109.48.27
52.109.56.36
52.109.112.84
52.109.2.57
52.109.116.45
52.109.112.50
52.109.32.34
52.118.59.43
52.109.44.33
52.109.44.31
52.109.48.27
52.109.64.26
52.109.56.57
52.109.0.48
52.109.2.57
52.109.52.56
52.109.12.15
52.109.96.24
52.109.12.99
52.109.88.196
52.109.132.71
================================================
FILE: data/Windows_Update.txt
================================================
182.101.26.4
182.101.26.120
182.108.43.1
183.232.171.123
222.186.49.117
182.101.26.2
118.180.61.1
119.36.226.247
182.101.26.121
182.84.202.1
58.216.107.92
113.7.202.1
222.213.21.1
153.35.101.35
1.180.27.251
118.112.23.229
112.13.208.244
222.138.71.115
182.101.26.3
175.6.13.246
23.32.56.152
1.198.5.228
42.202.37.2
123.245.253.229
121.12.122.114
60.167.222.69
8.241.177.254
182.150.10.39
150.138.231.145
61.133.64.1
221.228.67.211
106.120.158.105
123.161.59.231
117.169.12.80
58.49.136.3
221.195.206.1
220.194.79.74
122.246.3.213
58.49.157.119
59.63.237.196
106.7.64.1
221.228.219.190
117.34.50.92
58.216.106.229
219.146.241.121
182.108.43.2
58.49.180.1
111.29.52.251
221.228.67.151
122.227.201.1
221.228.67.207
182.101.26.6
180.96.0.13
42.202.37.5
175.6.153.1
220.194.87.114
61.240.218.1
104.91.69.89
13.107.4.50
205.185.216.10
104.91.69.98
205.185.216.42
121.254.136.59
139.175.236.56
184.150.58.154
8.241.175.254
23.216.159.9
104.91.69.56
23.32.238.235
23.205.154.24
112.16.236.207
8.255.130.126
23.205.154.9
93.184.221.240
23.216.159.35
125.89.168.1
8.241.154.254
124.229.62.1
================================================
FILE: data/Xbox_Cloud_Sync.txt
================================================
13.107.42.15
52.252.254.179
52.156.94.70
13.107.3.1
13.107.6.1
13.107.7.1
13.107.5.2
13.107.47.1
13.107.46.2
13.107.49.1
13.107.51.50
131.253.21.2
131.253.33.1
150.171.32.6
150.171.40.6
52.113.194.1
52.113.196.1
52.113.197.6
13.107.52.1
================================================
FILE: data/Xbox_Live_CDN_1.txt
================================================
184.50.87.35
184.50.87.32
104.100.95.19
2.21.71.177
63.217.233.11
104.100.95.17
23.202.34.235
23.215.102.57
23.67.53.41
23.223.57.144
184.50.26.66
23.54.162.153
104.109.128.112
23.40.207.40
23.40.41.27
23.54.162.208
88.221.134.216
23.32.237.51
23.223.54.163
23.47.190.137
184.26.91.47
104.99.238.113
104.98.114.24
104.109.128.115
23.59.190.187
23.215.100.229
23.35.98.24
23.55.220.137
95.101.34.81
23.194.213.139
23.61.195.26
23.220.167.105
172.232.16.145
184.50.26.64
23.40.197.194
23.56.237.205
92.122.244.11
184.28.75.160
23.223.57.161
23.192.47.161
104.91.69.16
63.217.233.16
23.220.167.123
23.55.220.161
104.99.238.65
88.221.134.179
92.123.245.128
23.50.129.82
184.28.223.16
23.45.112.161
184.86.250.24
96.17.102.33
96.7.128.75
23.196.47.89
139.175.87.19
23.204.146.203
203.74.140.202
23.32.236.59
121.254.136.48
119.207.64.136
184.28.223.96
23.32.236.106
23.196.47.99
23.204.146.137
23.52.0.185
2.16.186.26
92.123.77.32
184.28.218.131
23.35.111.74
23.67.53.137
23.33.33.178
23.32.236.32
184.150.58.152
================================================
FILE: data/Xbox_Live_CDN_2.txt
================================================
173.222.180.12
23.40.180.10
23.40.44.10
23.40.1.117
23.3.84.10
104.85.244.12
104.95.252.10
23.195.254.33
23.205.36.9
23.36.176.11
96.16.108.10
23.51.208.11
184.27.212.18
104.74.20.10
104.75.164.10
104.91.76.10
23.200.148.10
23.207.172.10
23.56.0.33
95.100.144.34
23.0.246.37
23.204.248.59
104.118.220.22
184.27.28.11
104.123.204.11
23.47.120.15
104.102.28.11
23.53.252.13
23.59.156.11
23.48.228.10
23.193.52.13
23.57.112.17
23.55.248.10
23.40.120.10
223.119.202.32
23.1.244.11
104.85.0.10
23.78.216.11
96.16.88.10
23.72.44.9
104.124.45.99
2.18.232.16
23.45.132.11
23.45.196.54
173.223.108.10
================================================
FILE: index.html
================================================
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/webp" href="favicon.webp">
<title>Microsoft Hosts Picker</title>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&family=Noto+Sans+SC:wght@400;700&display=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<header>
<h1 class="title">Microsoft Hosts Picker 💊</h1>
<p class="description" data-en="Optimize your Microsoft service connection speed" data-zh="优化您的 Microsoft 服务连接速度"></p>
<div class="language-switch">
<button id="zh-btn" class="active">中文</button>
<button id="en-btn">English</button>
</div>
</header>
<main>
<div class="features">
<div class="feature">
<span class="emoji">🚀</span>
<h3 data-en="Fast Connection" data-zh="快速连接"></h3>
<p data-en="Automatically select the fastest IP address" data-zh="自动选择最快的 IP 地址"></p>
</div>
<div class="feature">
<span class="emoji">🛡️</span>
<h3 data-en="Safe and Reliable" data-zh="安全可靠"></h3>
<p data-en="Use official IP addresses to ensure security" data-zh="使用官方 IP 地址,确保安全"></p>
</div>
<div class="feature">
<span class="emoji">⚙️</span>
<h3 data-en="Easy to Use" data-zh="易于使用"></h3>
<p data-en="Generate optimized hosts file with one click" data-zh="一键生成优化后的 hosts 文件"></p>
</div>
</div>
<div class="action-buttons">
<a href="https://mshost.hee.ink/MicrosoftHostsPicker.zip" class="cta-button download-button" data-en="Download ZIP" data-zh="下载 ZIP 文件"></a>
<a href="https://github.com/ButaiKirin/MicrosoftHostsPicker" class="cta-button github-button" data-en="View on GitHub" data-zh="在 GitHub 上查看"></a>
</div>
</main>
<footer>
<p>
© <span id="copyright-years"></span> ButaiKirin. Released under the <a href="https://github.com/ButaiKirin/MicrosoftHostsPicker/blob/main/LICENSE" target="_blank" rel="noopener noreferrer">MIT License</a>.
</p>
</footer>
</div>
<script src="script.js"></script>
</body>
</html>
================================================
FILE: requirements.txt
================================================
ping3==4.0.4
================================================
FILE: script.js
================================================
document.addEventListener('DOMContentLoaded', () => {
const features = document.querySelectorAll('.feature');
const quickStart = document.querySelector('.quick-start');
// 计算特性卡片动画的总持续时间
const lastFeatureDelay = 0.6; // 最后一个特性卡片的延迟
const featureAnimationDuration = 0.6; // 每个特性卡片的动画持续时间
const totalFeatureAnimationTime = lastFeatureDelay + featureAnimationDuration;
const zhBtn = document.getElementById('zh-btn');
const enBtn = document.getElementById('en-btn');
function setLanguage(lang) {
document.querySelectorAll('[data-en]').forEach(elem => {
elem.textContent = elem.getAttribute(`data-${lang}`);
});
if (lang === 'en') {
zhBtn.classList.remove('active');
enBtn.classList.add('active');
document.documentElement.lang = 'en';
} else {
enBtn.classList.remove('active');
zhBtn.classList.add('active');
document.documentElement.lang = 'zh-CN';
}
}
zhBtn.addEventListener('click', () => setLanguage('zh'));
enBtn.addEventListener('click', () => setLanguage('en'));
// 自动检测浏览器语言
const userLang = navigator.language || navigator.userLanguage;
setLanguage(userLang.startsWith('zh') ? 'zh' : 'en');
// 设置版权年份
const copyrightYearsSpan = document.getElementById('copyright-years');
const startYear = 2021;
const currentYear = new Date().getFullYear();
copyrightYearsSpan.textContent = startYear === currentYear ? startYear : `${startYear}-${currentYear}`;
// 获取 GitHub star 数量
fetch('https://api.github.com/repos/ButaiKirin/MicrosoftHostsPicker')
.then(response => response.json())
.then(data => {
const starCount = document.getElementById('star-count');
starCount.textContent = data.stargazers_count;
})
.catch(error => console.error('Error fetching GitHub stats:', error));
});
================================================
FILE: style.css
================================================
:root {
--bg-color: #F3F9FF;
--primary-color: #e87a90;
--secondary-color: #ffe8ea;
--text-color: #F596AA;
--accent-color: #e15e83;
--accent-color-rgb: 232, 48, 21;
}
body {
font-family: 'Noto Sans SC', 'Noto Sans JP', sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background-color: white;
border-radius: 24px;
padding: 2rem;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
text-align: center;
max-width: 800px;
width: 90%;
transition: all 0.3s ease;
}
.container:hover {
transform: translateY(-5px);
box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
}
.title {
color: var(--primary-color);
font-size: 2.5rem;
margin-bottom: 0.5rem;
animation: fadeInDown 1s ease-out;
}
.description {
color: var(--text-color);
font-size: 1.2rem;
margin-bottom: 1rem;
animation: fadeInUp 1s ease-out 0.5s both;
}
.language-switch {
margin-bottom: 2rem;
animation: fadeInUp 0.6s ease-out 0.8s both;
}
.language-switch button {
background-color: transparent;
border: 1px solid var(--primary-color);
color: var(--primary-color);
padding: 0.5rem 1rem;
margin: 0 0.5rem;
border-radius: 20px;
cursor: pointer;
transition: all 0.3s ease;
}
.language-switch button.active {
background-color: var(--primary-color);
color: white;
}
.language-switch button:hover {
transform: translateY(-2px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.features {
display: flex;
justify-content: space-around;
margin-bottom: 2rem;
}
.feature {
flex: 1;
margin: 0 1rem;
padding: 1.5rem;
background-color: var(--secondary-color);
border-radius: 16px;
transition: all 0.3s ease;
animation: fadeInUp 0.6s ease-out backwards;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}
.feature:hover {
transform: translateY(-5px);
box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}
.emoji {
font-size: 3rem;
margin-bottom: 1rem;
}
.feature h3 {
color: var(--primary-color);
margin-bottom: 0.5rem;
}
.feature p {
color: var(--text-color);
}
.cta-button {
display: inline-block;
background-color: var(--accent-color);
color: white;
padding: 1rem 2rem;
border-radius: 30px;
text-decoration: none;
font-weight: bold;
font-size: 1.2rem;
transition: all 0.3s ease;
animation:
fadeInUp 0.6s ease-out 1s both,
pulse 2s infinite;
position: relative;
overflow: hidden;
}
.cta-button::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
to right,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.3) 50%,
rgba(255, 255, 255, 0) 100%
);
transform: rotate(45deg);
animation: shimmer 3s infinite;
}
.cta-button:hover {
background-color: #C62700;
transform: translateY(-3px);
box-shadow: 0 6px 12px rgba(var(--accent-color-rgb), 0.3);
}
.cta-button:active {
transform: translateY(-1px);
box-shadow: 0 3px 6px rgba(var(--accent-color-rgb), 0.2);
}
footer {
margin-top: 2rem;
font-size: 0.9rem;
color: var(--text-color);
text-align: center;
}
footer a {
color: var(--primary-color);
text-decoration: none;
}
footer a:hover {
text-decoration: underline;
}
@keyframes fadeInDown {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(var(--accent-color-rgb), 0.4);
}
70% {
box-shadow: 0 0 0 15px rgba(var(--accent-color-rgb), 0);
}
100% {
box-shadow: 0 0 0 0 rgba(var(--accent-color-rgb), 0);
}
}
@keyframes shimmer {
0% {
background-position: -100% 0;
}
100% {
background-position: 100% 0;
}
}
@media (max-width: 768px) {
.features {
flex-direction: column;
}
.feature {
margin: 1rem 0;
}
}
.feature:nth-child(1) {
animation-delay: 0.2s;
}
.feature:nth-child(2) {
animation-delay: 0.4s;
}
.feature:nth-child(3) {
animation-delay: 0.6s;
}
.features {
margin-bottom: 3rem;
}
.quick-start {
margin-top: 3rem;
}
.steps ul, .usage-tips ul {
list-style-type: none;
padding-left: 0;
margin: 0;
}
.steps li, .usage-tips li {
margin-bottom: 1rem;
}
.github-stats {
display: flex;
justify-content: center;
margin: 1rem 0;
animation: fadeIn 1s ease-out;
}
.github-stars {
display: inline-flex;
align-items: center;
background-color: #f0f0f0;
color: #333;
padding: 0.5rem 1rem;
border-radius: 20px;
text-decoration: none;
font-size: 0.9rem;
transition: all 0.3s ease;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.github-stars:hover {
background-color: #e0e0e0;
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.github-stars svg {
margin-right: 0.5rem;
fill: #f1e05a;
}
.action-buttons {
display: flex;
justify-content: center;
gap: 1rem;
margin-top: 2rem;
}
.cta-button {
display: inline-block;
padding: 0.8rem 1.5rem;
border-radius: 30px;
text-decoration: none;
font-weight: bold;
font-size: 1rem;
transition: all 0.3s ease;
text-align: center;
}
.download-button {
background-color: var(--accent-color);
color: white;
}
.download-button:hover {
background-color: #C62700;
transform: translateY(-3px);
box-shadow: 0 4px 8px rgba(232, 48, 21, 0.3);
}
.github-button {
background-color: #f0f0f0;
color: #333;
}
.github-button:hover {
background-color: #e0e0e0;
transform: translateY(-3px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.action-buttons {
animation: fadeInUp 0.6s ease-out 1s both;
}
gitextract_xfih8thy/ ├── .gitignore ├── LICENSE ├── MicrosoftHostsPicker.py ├── README.md ├── data/ │ ├── Microsoft_Account.txt │ ├── Microsoft_Games_Download.txt │ ├── Microsoft_Login.txt │ ├── Microsoft_Store_Images.txt │ ├── Microsoft_Store_Pages.txt │ ├── Office_CDN.txt │ ├── OneNote.txt │ ├── Windows_Update.txt │ ├── Xbox_Cloud_Sync.txt │ ├── Xbox_Live_CDN_1.txt │ └── Xbox_Live_CDN_2.txt ├── index.html ├── requirements.txt ├── script.js └── style.css
SYMBOL INDEX (5 symbols across 2 files)
FILE: MicrosoftHostsPicker.py
function ping_ip (line 6) | def ping_ip(ip: str, attempts: int = 3, timeout: float = 1.0) -> float:
function process_ip_list (line 16) | def process_ip_list(file_path: str) -> Tuple[str, float]:
function write_hosts_section (line 29) | def write_hosts_section(hosts_file, title: str, ip: str, domains: List[s...
function main (line 36) | def main():
FILE: script.js
function setLanguage (line 14) | function setLanguage(lang) {
Condensed preview — 19 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (31K chars).
[
{
"path": ".gitignore",
"chars": 5,
"preview": "hosts"
},
{
"path": "LICENSE",
"chars": 1065,
"preview": "MIT License\n\nCopyright (c) 2021 Konnyaku\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\no"
},
{
"path": "MicrosoftHostsPicker.py",
"chars": 4566,
"preview": "import concurrent.futures\nfrom typing import List, Tuple\nfrom ping3 import ping\n\n\ndef ping_ip(ip: str, attempts: int = 3"
},
{
"path": "README.md",
"chars": 1283,
"preview": "# Microsoft Hosts Picker - M$💊\n\nA lightweight Python script to help you select the fastest IP addresses for Microsoft se"
},
{
"path": "data/Microsoft_Account.txt",
"chars": 1952,
"preview": "23.192.120.51\r\n23.205.249.96\r\n23.43.191.223\r\n184.26.37.234\r\n184.31.41.99\r\n104.126.22.240\r\n23.198.123.197\r\n96.16.0.12\r\n10"
},
{
"path": "data/Microsoft_Games_Download.txt",
"chars": 1170,
"preview": "23.210.215.81\r\n23.50.57.116\r\n23.210.215.105\r\n23.44.4.234\r\n23.196.11.62\r\n208.185.115.97\r\n92.123.77.74\r\n23.215.190.208\r\n10"
},
{
"path": "data/Microsoft_Login.txt",
"chars": 226,
"preview": "117.28.245.88\r\n152.199.40.6\r\n13.107.213.49\r\n13.107.246.49\r\n13.107.246.69\r\n13.107.246.38\r\n192.229.211.199\r\n13.107.246.46\r"
},
{
"path": "data/Microsoft_Store_Images.txt",
"chars": 479,
"preview": "184.25.249.141\r\n23.45.61.216\r\n23.200.153.227\r\n23.45.57.216\r\n23.197.185.151\r\n184.50.93.123\r\n23.44.1.197\r\n23.50.125.135\r\n1"
},
{
"path": "data/Microsoft_Store_Pages.txt",
"chars": 387,
"preview": "117.21.204.223\r\n221.230.146.211\r\n60.210.8.160\r\n223.111.105.38\r\n27.148.138.181\r\n182.247.226.216\r\n221.194.157.13\r\n122.224."
},
{
"path": "data/Office_CDN.txt",
"chars": 2055,
"preview": "112.65.118.99\r\n218.2.0.234\r\n49.79.237.57\r\n221.194.154.121\r\n202.109.143.67\r\n116.207.139.42\r\n49.79.237.56\r\n124.205.198.173"
},
{
"path": "data/OneNote.txt",
"chars": 393,
"preview": "52.109.2.48\r\n52.109.92.45\r\n52.109.132.46\r\n52.109.28.36\r\n52.109.88.148\r\n52.109.44.33\r\n52.109.44.31\r\n52.109.48.27\r\n52.109."
},
{
"path": "data/Windows_Update.txt",
"chars": 1157,
"preview": "182.101.26.4\r\n182.101.26.120\r\n182.108.43.1\r\n183.232.171.123\r\n222.186.49.117\r\n182.101.26.2\r\n118.180.61.1\r\n119.36.226.247\r"
},
{
"path": "data/Xbox_Cloud_Sync.txt",
"chars": 254,
"preview": "13.107.42.15\r\n52.252.254.179\r\n52.156.94.70\r\n13.107.3.1\r\n13.107.6.1\r\n13.107.7.1\r\n13.107.5.2\r\n13.107.47.1\r\n13.107.46.2\r\n13"
},
{
"path": "data/Xbox_Live_CDN_1.txt",
"chars": 1079,
"preview": "184.50.87.35\r\n184.50.87.32\r\n104.100.95.19\r\n2.21.71.177\r\n63.217.233.11\r\n104.100.95.17\r\n23.202.34.235\r\n23.215.102.57\r\n23.6"
},
{
"path": "data/Xbox_Live_CDN_2.txt",
"chars": 635,
"preview": "173.222.180.12\r\n23.40.180.10\r\n23.40.44.10\r\n23.40.1.117\r\n23.3.84.10\r\n104.85.244.12\r\n104.95.252.10\r\n23.195.254.33\r\n23.205."
},
{
"path": "index.html",
"chars": 2575,
"preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-wi"
},
{
"path": "requirements.txt",
"chars": 13,
"preview": "ping3==4.0.4\n"
},
{
"path": "script.js",
"chars": 1965,
"preview": "document.addEventListener('DOMContentLoaded', () => {\n const features = document.querySelectorAll('.feature');\n co"
},
{
"path": "style.css",
"chars": 6484,
"preview": ":root {\n --bg-color: #F3F9FF;\n --primary-color: #e87a90;\n --secondary-color: #ffe8ea;\n --text-color: #F596AA"
}
]
About this extraction
This page contains the full source code of the ZeroSimple/MicrosoftHostsPicker GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 19 files (27.1 KB), approximately 10.6k tokens, and a symbol index with 5 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.