mirror of
https://github.com/saveweb/is-github-page.git
synced 2024-09-18 16:15:28 -07:00
v1.0
This commit is contained in:
parent
5d6210a8c6
commit
181c1f1977
@ -3,9 +3,9 @@
|
||||
"main.py": [
|
||||
{
|
||||
"id": "0e650fa4-e0c0-491d-8fb7-30fe08386e78",
|
||||
"line": 25,
|
||||
"version": 1862,
|
||||
"index": 715
|
||||
"line": 27,
|
||||
"version": 1863,
|
||||
"index": 764
|
||||
}
|
||||
]
|
||||
}
|
||||
|
10
main.py
10
main.py
@ -4,9 +4,11 @@ import urllib.request
|
||||
import urllib.parse
|
||||
num = 1
|
||||
|
||||
|
||||
githubip = urllib.request.urlopen('https://api.github.com/meta')
|
||||
githubip = str(githubip.read())
|
||||
try:
|
||||
githubip = urllib.request.urlopen('https://api.github.com/meta')
|
||||
githubip = str(githubip.read())
|
||||
except:
|
||||
print('无法访问GitHub-API,请检查网络。')
|
||||
|
||||
try:
|
||||
os.system("wget https://github.com/timqian/chinese-independent-blogs/raw/master/blogs-original.csv -O ./blogs-original.csv")
|
||||
@ -32,7 +34,7 @@ else:
|
||||
isfind = githubip.find(ip_head)
|
||||
if isfind != -1 :
|
||||
f.write(domain+"\n")
|
||||
print(domain+" is on GH-page!")
|
||||
print(domain+" 是GH-Pages!")
|
||||
except:
|
||||
continue
|
||||
os.system("rm blogs-original.csv -rf")
|
26
single-check.py
Normal file
26
single-check.py
Normal file
@ -0,0 +1,26 @@
|
||||
import socket
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
|
||||
try:
|
||||
githubip = urllib.request.urlopen('https://api.github.com/meta')
|
||||
githubip = str(githubip.read())
|
||||
except:
|
||||
print('无法访问GitHub-API,请检查网络。')
|
||||
else:
|
||||
print('请输入域名/链接')
|
||||
line = input()
|
||||
line = line.replace(" ", "")
|
||||
res = urllib.parse.urlparse(line)
|
||||
domain = res.netloc
|
||||
try:
|
||||
ip = socket.gethostbyname(domain)
|
||||
ip = ip.split('.')
|
||||
ip_head = ip[0]+'.'+ip[1]+'.'+ip[2]
|
||||
isfind = githubip.find(ip_head)
|
||||
if isfind != -1 :
|
||||
print(domain+" 是GH-Pages!")
|
||||
else:
|
||||
print(domain+" 不是GH-Pages!")
|
||||
except:
|
||||
print('错误: DNS无法解析或其它问题。')
|
Loading…
Reference in New Issue
Block a user