mirror of
https://github.com/521xueweihan/GitHub520.git
synced 2025-09-26 20:31:33 +08:00
fix: github action bug
This commit is contained in:
4
.github/workflows/GitHub520.yml
vendored
4
.github/workflows/GitHub520.yml
vendored
@@ -24,11 +24,11 @@ jobs:
|
|||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
if [ -f requirements.txt ]; then sudo pip install -r requirements.txt; fi
|
if [ -f actions_requirements.txt ]; then pip install -r actions_requirements.txt; fi
|
||||||
- name: run script
|
- name: run script
|
||||||
run: |
|
run: |
|
||||||
# fetch new ip content and update readme file
|
# fetch new ip content and update readme file
|
||||||
sudo python fetch_ips.py
|
python update_ips.py
|
||||||
- name: commit
|
- name: commit
|
||||||
id: commit
|
id: commit
|
||||||
run: |
|
run: |
|
||||||
|
28
README.md
28
README.md
@@ -37,8 +37,8 @@
|
|||||||
```bash
|
```bash
|
||||||
# GitHub520 Host Start
|
# GitHub520 Host Start
|
||||||
140.82.112.26 alive.github.com
|
140.82.112.26 alive.github.com
|
||||||
140.82.112.6 api.github.com
|
140.82.114.6 api.github.com
|
||||||
185.199.108.153 assets-cdn.github.com
|
185.199.109.153 assets-cdn.github.com
|
||||||
185.199.111.133 avatars.githubusercontent.com
|
185.199.111.133 avatars.githubusercontent.com
|
||||||
185.199.111.133 avatars0.githubusercontent.com
|
185.199.111.133 avatars0.githubusercontent.com
|
||||||
185.199.111.133 avatars1.githubusercontent.com
|
185.199.111.133 avatars1.githubusercontent.com
|
||||||
@@ -46,23 +46,23 @@
|
|||||||
185.199.111.133 avatars3.githubusercontent.com
|
185.199.111.133 avatars3.githubusercontent.com
|
||||||
185.199.111.133 avatars4.githubusercontent.com
|
185.199.111.133 avatars4.githubusercontent.com
|
||||||
185.199.111.133 avatars5.githubusercontent.com
|
185.199.111.133 avatars5.githubusercontent.com
|
||||||
185.199.110.133 camo.githubusercontent.com
|
185.199.111.133 camo.githubusercontent.com
|
||||||
140.82.112.21 central.github.com
|
140.82.114.22 central.github.com
|
||||||
185.199.111.133 cloud.githubusercontent.com
|
185.199.111.133 cloud.githubusercontent.com
|
||||||
140.82.113.10 codeload.github.com
|
140.82.114.9 codeload.github.com
|
||||||
140.82.114.21 collector.github.com
|
140.82.114.21 collector.github.com
|
||||||
185.199.111.133 desktop.githubusercontent.com
|
185.199.111.133 desktop.githubusercontent.com
|
||||||
185.199.111.133 favicons.githubusercontent.com
|
185.199.111.133 favicons.githubusercontent.com
|
||||||
140.82.112.3 gist.github.com
|
140.82.114.4 gist.github.com
|
||||||
54.231.230.65 github-cloud.s3.amazonaws.com
|
54.231.230.65 github-cloud.s3.amazonaws.com
|
||||||
52.216.141.212 github-com.s3.amazonaws.com
|
52.216.141.212 github-com.s3.amazonaws.com
|
||||||
16.182.108.113 github-production-release-asset-2e65be.s3.amazonaws.com
|
3.5.28.20 github-production-release-asset-2e65be.s3.amazonaws.com
|
||||||
52.216.51.225 github-production-repository-file-5c1aeb.s3.amazonaws.com
|
3.5.2.232 github-production-repository-file-5c1aeb.s3.amazonaws.com
|
||||||
52.217.192.249 github-production-user-asset-6210df.s3.amazonaws.com
|
52.217.167.97 github-production-user-asset-6210df.s3.amazonaws.com
|
||||||
192.0.66.2 github.blog
|
192.0.66.2 github.blog
|
||||||
140.82.114.3 github.com
|
140.82.114.3 github.com
|
||||||
140.82.113.17 github.community
|
140.82.113.17 github.community
|
||||||
185.199.110.154 github.githubassets.com
|
185.199.108.154 github.githubassets.com
|
||||||
151.101.193.194 github.global.ssl.fastly.net
|
151.101.193.194 github.global.ssl.fastly.net
|
||||||
185.199.108.153 github.io
|
185.199.108.153 github.io
|
||||||
185.199.111.133 github.map.fastly.net
|
185.199.111.133 github.map.fastly.net
|
||||||
@@ -72,19 +72,19 @@
|
|||||||
185.199.110.133 objects.githubusercontent.com
|
185.199.110.133 objects.githubusercontent.com
|
||||||
13.107.42.16 pipelines.actions.githubusercontent.com
|
13.107.42.16 pipelines.actions.githubusercontent.com
|
||||||
185.199.111.133 raw.githubusercontent.com
|
185.199.111.133 raw.githubusercontent.com
|
||||||
185.199.110.133 user-images.githubusercontent.com
|
185.199.111.133 user-images.githubusercontent.com
|
||||||
140.82.113.21 education.github.com
|
127.0.0.105 education.github.com
|
||||||
185.199.111.133 private-user-images.githubusercontent.com
|
185.199.111.133 private-user-images.githubusercontent.com
|
||||||
|
|
||||||
|
|
||||||
# Update time: 2025-01-10T14:08:05+08:00
|
# Update time: 2025-01-16T21:13:43+08:00
|
||||||
# Update url: https://raw.hellogithub.com/hosts
|
# Update url: https://raw.hellogithub.com/hosts
|
||||||
# Star me: https://github.com/521xueweihan/GitHub520
|
# Star me: https://github.com/521xueweihan/GitHub520
|
||||||
# GitHub520 Host End
|
# GitHub520 Host End
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
该内容会自动定时更新, 数据更新时间:2025-01-10T14:08:05+08:00
|
该内容会自动定时更新, 数据更新时间:2025-01-16T21:13:43+08:00
|
||||||
|
|
||||||
#### 2.1.2 修改 hosts 文件
|
#### 2.1.2 修改 hosts 文件
|
||||||
|
|
||||||
|
3
actions_requirements.txt
Normal file
3
actions_requirements.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
requests-html==0.10.0
|
||||||
|
retry==0.9.2
|
||||||
|
lxml_html_clean
|
105
common.py
Normal file
105
common.py
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding:utf-8 -*-
|
||||||
|
#
|
||||||
|
# Author : XueWeiHan
|
||||||
|
# E-mail : 595666367@qq.com
|
||||||
|
# Date : 2025-01-16 15:27
|
||||||
|
# Desc : 公共函数
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
from typing import Any, Optional
|
||||||
|
from datetime import datetime, timezone, timedelta
|
||||||
|
|
||||||
|
from retry import retry
|
||||||
|
|
||||||
|
GITHUB_URLS = [
|
||||||
|
'alive.github.com', 'api.github.com', 'assets-cdn.github.com',
|
||||||
|
'avatars.githubusercontent.com', 'avatars0.githubusercontent.com',
|
||||||
|
'avatars1.githubusercontent.com', 'avatars2.githubusercontent.com',
|
||||||
|
'avatars3.githubusercontent.com', 'avatars4.githubusercontent.com',
|
||||||
|
'avatars5.githubusercontent.com', 'camo.githubusercontent.com',
|
||||||
|
'central.github.com', 'cloud.githubusercontent.com', 'codeload.github.com',
|
||||||
|
'collector.github.com', 'desktop.githubusercontent.com',
|
||||||
|
'favicons.githubusercontent.com', 'gist.github.com',
|
||||||
|
'github-cloud.s3.amazonaws.com', 'github-com.s3.amazonaws.com',
|
||||||
|
'github-production-release-asset-2e65be.s3.amazonaws.com',
|
||||||
|
'github-production-repository-file-5c1aeb.s3.amazonaws.com',
|
||||||
|
'github-production-user-asset-6210df.s3.amazonaws.com', 'github.blog',
|
||||||
|
'github.com', 'github.community', 'github.githubassets.com',
|
||||||
|
'github.global.ssl.fastly.net', 'github.io', 'github.map.fastly.net',
|
||||||
|
'githubstatus.com', 'live.github.com', 'media.githubusercontent.com',
|
||||||
|
'objects.githubusercontent.com', 'pipelines.actions.githubusercontent.com',
|
||||||
|
'raw.githubusercontent.com', 'user-images.githubusercontent.com',
|
||||||
|
'vscode.dev', 'education.github.com', 'private-user-images.githubusercontent.com'
|
||||||
|
]
|
||||||
|
|
||||||
|
HOSTS_TEMPLATE = """# GitHub520 Host Start
|
||||||
|
{content}
|
||||||
|
|
||||||
|
# Update time: {update_time}
|
||||||
|
# Update url: https://raw.hellogithub.com/hosts
|
||||||
|
# Star me: https://github.com/521xueweihan/GitHub520
|
||||||
|
# GitHub520 Host End\n"""
|
||||||
|
|
||||||
|
|
||||||
|
@retry(tries=3)
|
||||||
|
def get_json(session: Any) -> Optional[list]:
|
||||||
|
url = 'https://raw.hellogithub.com/hosts.json'
|
||||||
|
try:
|
||||||
|
rs = session.get(url)
|
||||||
|
data = json.loads(rs.text)
|
||||||
|
return data
|
||||||
|
except Exception as ex:
|
||||||
|
print(f"get: {url}, error: {ex}")
|
||||||
|
raise Exception
|
||||||
|
|
||||||
|
|
||||||
|
def write_file(hosts_content: str, update_time: str) -> bool:
|
||||||
|
output_doc_file_path = os.path.join(os.path.dirname(__file__), "README.md")
|
||||||
|
template_path = os.path.join(os.path.dirname(__file__),
|
||||||
|
"README_template.md")
|
||||||
|
write_host_file(hosts_content)
|
||||||
|
if os.path.exists(output_doc_file_path):
|
||||||
|
with open(output_doc_file_path, "r") as old_readme_fb:
|
||||||
|
old_content = old_readme_fb.read()
|
||||||
|
if old_content:
|
||||||
|
old_hosts = old_content.split("```bash")[1].split("```")[0].strip()
|
||||||
|
old_hosts = old_hosts.split("# Update time:")[0].strip()
|
||||||
|
hosts_content_hosts = hosts_content.split("# Update time:")[
|
||||||
|
0].strip()
|
||||||
|
if old_hosts == hosts_content_hosts:
|
||||||
|
print("host not change")
|
||||||
|
return False
|
||||||
|
|
||||||
|
with open(template_path, "r") as temp_fb:
|
||||||
|
template_str = temp_fb.read()
|
||||||
|
hosts_content = template_str.format(hosts_str=hosts_content,
|
||||||
|
update_time=update_time)
|
||||||
|
with open(output_doc_file_path, "w") as output_fb:
|
||||||
|
output_fb.write(hosts_content)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def write_host_file(hosts_content: str) -> None:
|
||||||
|
output_file_path = os.path.join(os.path.dirname(__file__), 'hosts')
|
||||||
|
with open(output_file_path, "w") as output_fb:
|
||||||
|
output_fb.write(hosts_content)
|
||||||
|
|
||||||
|
|
||||||
|
def write_json_file(hosts_list: list) -> None:
|
||||||
|
output_file_path = os.path.join(os.path.dirname(__file__), 'hosts.json')
|
||||||
|
with open(output_file_path, "w") as output_fb:
|
||||||
|
json.dump(hosts_list, output_fb)
|
||||||
|
|
||||||
|
|
||||||
|
def write_hosts_content(content: str, content_list: list) -> str:
|
||||||
|
if not content:
|
||||||
|
return ""
|
||||||
|
update_time = datetime.now(timezone.utc).astimezone(
|
||||||
|
timezone(timedelta(hours=8))).replace(microsecond=0).isoformat()
|
||||||
|
hosts_content = HOSTS_TEMPLATE.format(content=content,
|
||||||
|
update_time=update_time)
|
||||||
|
has_change = write_file(hosts_content, update_time)
|
||||||
|
if has_change:
|
||||||
|
write_json_file(content_list)
|
||||||
|
return hosts_content
|
150
fetch_ips.py
150
fetch_ips.py
@@ -5,95 +5,26 @@
|
|||||||
# E-mail : 595666367@qq.com
|
# E-mail : 595666367@qq.com
|
||||||
# Date : 2020-05-19 15:27
|
# Date : 2020-05-19 15:27
|
||||||
# Desc : 获取最新的 GitHub 相关域名对应 IP
|
# Desc : 获取最新的 GitHub 相关域名对应 IP
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import json
|
|
||||||
import argparse
|
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
from datetime import datetime
|
||||||
from datetime import datetime, timezone, timedelta
|
|
||||||
|
|
||||||
from pythonping import ping
|
from pythonping import ping
|
||||||
from requests_html import HTMLSession
|
from requests_html import HTMLSession
|
||||||
from retry import retry
|
from retry import retry
|
||||||
|
|
||||||
GITHUB_URLS = [
|
from common import GITHUB_URLS, write_hosts_content
|
||||||
'alive.github.com', 'api.github.com', 'assets-cdn.github.com',
|
|
||||||
'avatars.githubusercontent.com', 'avatars0.githubusercontent.com',
|
|
||||||
'avatars1.githubusercontent.com', 'avatars2.githubusercontent.com',
|
|
||||||
'avatars3.githubusercontent.com', 'avatars4.githubusercontent.com',
|
|
||||||
'avatars5.githubusercontent.com', 'camo.githubusercontent.com',
|
|
||||||
'central.github.com', 'cloud.githubusercontent.com', 'codeload.github.com',
|
|
||||||
'collector.github.com', 'desktop.githubusercontent.com',
|
|
||||||
'favicons.githubusercontent.com', 'gist.github.com',
|
|
||||||
'github-cloud.s3.amazonaws.com', 'github-com.s3.amazonaws.com',
|
|
||||||
'github-production-release-asset-2e65be.s3.amazonaws.com',
|
|
||||||
'github-production-repository-file-5c1aeb.s3.amazonaws.com',
|
|
||||||
'github-production-user-asset-6210df.s3.amazonaws.com', 'github.blog',
|
|
||||||
'github.com', 'github.community', 'github.githubassets.com',
|
|
||||||
'github.global.ssl.fastly.net', 'github.io', 'github.map.fastly.net',
|
|
||||||
'githubstatus.com', 'live.github.com', 'media.githubusercontent.com',
|
|
||||||
'objects.githubusercontent.com', 'pipelines.actions.githubusercontent.com',
|
|
||||||
'raw.githubusercontent.com', 'user-images.githubusercontent.com',
|
|
||||||
'vscode.dev', 'education.github.com', 'private-user-images.githubusercontent.com'
|
|
||||||
]
|
|
||||||
|
|
||||||
HOSTS_TEMPLATE = """# GitHub520 Host Start
|
|
||||||
{content}
|
|
||||||
|
|
||||||
# Update time: {update_time}
|
|
||||||
# Update url: https://raw.hellogithub.com/hosts
|
|
||||||
# Star me: https://github.com/521xueweihan/GitHub520
|
|
||||||
# GitHub520 Host End\n"""
|
|
||||||
|
|
||||||
|
|
||||||
def write_file(hosts_content: str, update_time: str) -> bool:
|
|
||||||
output_doc_file_path = os.path.join(os.path.dirname(__file__), "README.md")
|
|
||||||
template_path = os.path.join(os.path.dirname(__file__),
|
|
||||||
"README_template.md")
|
|
||||||
write_host_file(hosts_content)
|
|
||||||
if os.path.exists(output_doc_file_path):
|
|
||||||
with open(output_doc_file_path, "r") as old_readme_fb:
|
|
||||||
old_content = old_readme_fb.read()
|
|
||||||
if old_content:
|
|
||||||
old_hosts = old_content.split("```bash")[1].split("```")[0].strip()
|
|
||||||
old_hosts = old_hosts.split("# Update time:")[0].strip()
|
|
||||||
hosts_content_hosts = hosts_content.split("# Update time:")[
|
|
||||||
0].strip()
|
|
||||||
if old_hosts == hosts_content_hosts:
|
|
||||||
print("host not change")
|
|
||||||
return False
|
|
||||||
|
|
||||||
with open(template_path, "r") as temp_fb:
|
|
||||||
template_str = temp_fb.read()
|
|
||||||
hosts_content = template_str.format(hosts_str=hosts_content,
|
|
||||||
update_time=update_time)
|
|
||||||
with open(output_doc_file_path, "w") as output_fb:
|
|
||||||
output_fb.write(hosts_content)
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def write_host_file(hosts_content: str) -> None:
|
|
||||||
output_file_path = os.path.join(os.path.dirname(__file__), 'hosts')
|
|
||||||
with open(output_file_path, "w") as output_fb:
|
|
||||||
output_fb.write(hosts_content)
|
|
||||||
|
|
||||||
|
|
||||||
def write_json_file(hosts_list: list) -> None:
|
|
||||||
output_file_path = os.path.join(os.path.dirname(__file__), 'hosts.json')
|
|
||||||
with open(output_file_path, "w") as output_fb:
|
|
||||||
json.dump(hosts_list, output_fb)
|
|
||||||
|
|
||||||
|
|
||||||
def get_best_ip(ip_list: list) -> str:
|
def get_best_ip(ip_list: list) -> str:
|
||||||
ping_timeout = 2
|
ping_timeout = 1
|
||||||
best_ip = ''
|
best_ip = ''
|
||||||
min_ms = ping_timeout * 500
|
min_ms = ping_timeout * 1000
|
||||||
ip_set = set(ip_list)
|
ip_set = set(ip_list)
|
||||||
for ip in ip_set:
|
for ip in ip_set:
|
||||||
ping_result = ping(ip, timeout=ping_timeout)
|
ping_result = ping(ip, timeout=ping_timeout)
|
||||||
print(ping_result.rtt_avg_ms)
|
print(f'ping {ip} {ping_result.rtt_avg_ms} ms')
|
||||||
if ping_result.rtt_avg_ms == ping_timeout * 500:
|
if ping_result.rtt_avg_ms == ping_timeout * 1000:
|
||||||
# 超时认为 IP 失效
|
# 超时认为 IP 失效
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
@@ -103,18 +34,6 @@ def get_best_ip(ip_list: list) -> str:
|
|||||||
return best_ip
|
return best_ip
|
||||||
|
|
||||||
|
|
||||||
@retry(tries=3)
|
|
||||||
def get_json(session: Any) -> Optional[list]:
|
|
||||||
url = 'https://raw.hellogithub.com/hosts.json'
|
|
||||||
try:
|
|
||||||
rs = session.get(url)
|
|
||||||
data = json.loads(rs.text)
|
|
||||||
return data
|
|
||||||
except Exception as ex:
|
|
||||||
print(f"get: {url}, error: {ex}")
|
|
||||||
raise Exception
|
|
||||||
|
|
||||||
|
|
||||||
@retry(tries=3)
|
@retry(tries=3)
|
||||||
def get_ip(session: Any, github_url: str) -> Optional[str]:
|
def get_ip(session: Any, github_url: str) -> Optional[str]:
|
||||||
url = f'https://sites.ipaddress.com/{github_url}'
|
url = f'https://sites.ipaddress.com/{github_url}'
|
||||||
@@ -130,52 +49,33 @@ def get_ip(session: Any, github_url: str) -> Optional[str]:
|
|||||||
if best_ip:
|
if best_ip:
|
||||||
return best_ip
|
return best_ip
|
||||||
else:
|
else:
|
||||||
raise Exception(f"url: {github_url}, ipaddress empty")
|
raise Exception("url: {github_url}, ipaddress empty")
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print(f"get: {url}, error: {ex}")
|
print("get: {url}, error: {ex}")
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
|
|
||||||
def main(verbose=False, model='server') -> None:
|
def main() -> None:
|
||||||
if verbose:
|
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||||
print('Start script.')
|
print(f'{current_time} - Start script.')
|
||||||
session = HTMLSession()
|
session = HTMLSession()
|
||||||
content = ""
|
content = ""
|
||||||
if model == 'server':
|
content_list = []
|
||||||
content_list = []
|
for index, github_url in enumerate(GITHUB_URLS):
|
||||||
for index, github_url in enumerate(GITHUB_URLS):
|
try:
|
||||||
try:
|
ip = get_ip(session, github_url)
|
||||||
ip = get_ip(session, github_url)
|
|
||||||
|
|
||||||
content += ip.ljust(30) + github_url + "\n"
|
content += ip.ljust(30) + github_url + "\n"
|
||||||
content_list.append((ip, github_url,))
|
content_list.append((ip, github_url,))
|
||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
if verbose:
|
print(f'Process url: {index + 1}/{len(GITHUB_URLS)}, {github_url}')
|
||||||
print(f'process url: {index + 1}/{len(GITHUB_URLS)}')
|
|
||||||
else:
|
|
||||||
content_list = get_json(session)
|
|
||||||
for item in content_list:
|
|
||||||
content += item[0].ljust(30) + item[1] + "\n"
|
|
||||||
|
|
||||||
if not content:
|
write_hosts_content(content, content_list)
|
||||||
return
|
# print(hosts_content)
|
||||||
update_time = datetime.utcnow().astimezone(
|
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||||
timezone(timedelta(hours=8))).replace(microsecond=0).isoformat()
|
print(f'{current_time} - End script.')
|
||||||
hosts_content = HOSTS_TEMPLATE.format(content=content,
|
|
||||||
update_time=update_time)
|
|
||||||
has_change = write_file(hosts_content, update_time)
|
|
||||||
if has_change:
|
|
||||||
write_json_file(content_list)
|
|
||||||
if verbose:
|
|
||||||
print(hosts_content)
|
|
||||||
print('End script.')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(description="Run fetch ips script")
|
main()
|
||||||
# 2. 定义参数
|
|
||||||
parser.add_argument('model', metavar='model', type=str, nargs='?')
|
|
||||||
# 3. 解析命令行
|
|
||||||
args = parser.parse_args()
|
|
||||||
main(True, args.model)
|
|
||||||
|
42
update_ips.py
Normal file
42
update_ips.py
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding:utf-8 -*-
|
||||||
|
#
|
||||||
|
# Author : XueWeiHan
|
||||||
|
# E-mail : 595666367@qq.com
|
||||||
|
# Date : 2025-01-16 15:27
|
||||||
|
# Desc : GitHub Action 运行的脚本
|
||||||
|
import json
|
||||||
|
from typing import Any, Optional
|
||||||
|
|
||||||
|
from retry import retry
|
||||||
|
from requests_html import HTMLSession
|
||||||
|
|
||||||
|
from common import write_hosts_content
|
||||||
|
|
||||||
|
|
||||||
|
@retry(tries=3)
|
||||||
|
def get_json(session: Any) -> Optional[list]:
|
||||||
|
url = 'https://raw.hellogithub.com/hosts.json'
|
||||||
|
try:
|
||||||
|
rs = session.get(url)
|
||||||
|
data = json.loads(rs.text)
|
||||||
|
return data
|
||||||
|
except Exception as ex:
|
||||||
|
print(f"get: {url}, error: {ex}")
|
||||||
|
raise Exception
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
print('Start script.')
|
||||||
|
session = HTMLSession()
|
||||||
|
content = ""
|
||||||
|
content_list = get_json(session)
|
||||||
|
for item in content_list:
|
||||||
|
content += item[0].ljust(30) + item[1] + "\n"
|
||||||
|
hosts_content = write_hosts_content(content, content_list)
|
||||||
|
print(hosts_content)
|
||||||
|
print('End script.')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Reference in New Issue
Block a user