Skip to content

Commit

Permalink
the-powder-toy.py: Get version from homepage an point to GitHub
Browse files Browse the repository at this point in the history
Unfortunately, the project does not use version numbers but
build numbers as their git tags. So we have to search the version
on the homepage and point to GitHub. This will 404 but at least
we are on the correct site for the source code.
The homepage seems to make some crazy OS guessing:
In my browser there is: "Version 85.0 for Linux" but with
python there is just "Version 85.0 for " (probably because
of the missing user agent).
  • Loading branch information
Christoph Korn committed Feb 9, 2013
1 parent 9564080 commit 8462552
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions the-powder-toy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import re
import urllib2
import sys
h=urllib2.urlopen("https://github.com/FacialTurd/PowderToypp/tags").read()
v_finder=re.compile('Version (?P<version>[\d\.]+) (?:.*)\(build (?P<build>[\d]+)\)', re.M)
h=urllib2.urlopen("http://powdertoy.co.uk/Download.html").read()
v_finder=re.compile('Version (?P<version>[\d\.]+) for (?:.*)</div>', re.M)
m=v_finder.finditer(h)
if not m: sys.exit()
for x in m:
v=x.group("version")
print "<a href='https://github.com/FacialTurd/PowderToypp/tags/%s'>%s</a>"%(v,v)
print "<a href='https://github.com/FacialTurd/The-Powder-Toy/tags/%s'>%s</a>"%(v,v)

0 comments on commit 8462552

Please sign in to comment.