Created
September 12, 2016 08:16
-
-
Save FGFW/6e2debc57412a7554b0cfc37cc0f8c9f to your computer and use it in GitHub Desktop.
python3检测phpbb3论坛版本号
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: UTF-8 -*- | |
""" | |
python3检测phpbb3论坛版本号 | |
2016年9月4日 10:25:06 codegay | |
#通过读取docs\CHANGELOG.html 判断phpbb3的版本 | |
""" | |
from urllib.request import urlopen | |
from urllib.parse import urljoin | |
import re | |
from requests import get | |
test_host = ["http://www.code-by.org", | |
"http://www.crug.org/", | |
"http://outdrs.mobi/", | |
"https://forum.catram.org/", | |
"http://forum.beesay.com/", | |
"http://callcq.com/", | |
"http://freebt.org/", | |
"http://www.gutone.com/", | |
"http://forum.groovecollection.nl/", | |
"http://openlora.com/forum/", | |
"https://forum.ripple.com/", | |
"http://forum.surdvd.com/", | |
"http://www.munyu.info/phpBB3/", | |
"http://forum.trinitigame.com/forum/", | |
"http://forum.xueapple.com/", | |
"http://www.open-gl.org/", | |
] | |
log_url = "docs/CHANGELOG.html" | |
def version(url): | |
try: | |
r = get(url) | |
rec = re.compile(r"(\d\.\d+.\d+-*\w*)") | |
if r.ok: # r.stats_code ==200 | |
result = rec.findall(r.text) | |
return result[0] | |
return 0 | |
except: | |
return 0 | |
for r in test_host: | |
url = urljoin(r,log_url) | |
ver = version(url) | |
print(url," ",ver) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment