- # -*- 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)
复制代码
|