Skip to content

Commit

Permalink
pycharm.py: Upstream uses JSON for release information
Browse files Browse the repository at this point in the history
Took me some JS debugging to get this URL :D
  • Loading branch information
ckorn committed Jan 10, 2016
1 parent ef2cb92 commit d408ba3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pycharm.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/usr/bin/python
import re
import urllib2
import json

def main():
h=urllib2.urlopen("http://www.jetbrains.com/js2/version.js").read()
v_finder=re.compile('var versionPyCharmLong = "(?P<version>[\d\.]+)";', re.M)
m=v_finder.finditer(h)
if not m: return
for x in m:
v=x.group("version")
print "<a href='http://download-ln.jetbrains.com/python/pycharm-community-%(v)s.tar.gz'>%(v)s</a>"%locals()
h=urllib2.urlopen("https://data.services.jetbrains.com/products/releases?code=PCP%2CPCC&latest=true&type=release").read()
j=json.loads(h)
#print json.dumps(j, indent=4, sort_keys=True)
print j["PCC"][0]["downloads"]["linux"]["link"]


if __name__ == "__main__":
main()

0 comments on commit d408ba3

Please sign in to comment.