mattfoster (owner)

Revisions

gist: 59370 Download_button fork
public
Public Clone URL: git://gist.github.com/59370.git
Embed All Files: show embed
heist_parse.py #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python
# Grab the width of the macheist bar.
# Run using:
# while true; do sleep 60; python heist_parse.py >> heist_countdown; done
 
import urllib2
import re
import time
 
from BeautifulSoup import BeautifulSoup
 
url='http://mainframe.macheist.com/'
 
page = urllib2.urlopen(url)
page = ''.join(page.readlines())
soup = BeautifulSoup(page)
 
desc = soup.fetch('div',{'class':'progress'})[0]['style']
print time.time(), '\t', re.search(r'^width: (.*)px$', desc).group(1)