Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # -*- coding: UTF-8 -*-
- import urllib2,cookielib,hashlib,notify2,threading
- site= "http://strimi.pl"
- hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
- 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
- 'Accept-Encoding': 'none',
- 'Accept-Language': 'en-US,en;q=0.8',
- 'Connection': 'keep-alive'}
- contentHash = "dde87921e6f333da6a1ca8ab0fb0c325" # 42
- def check ():
- threading.Timer(5.0, check).start()
- req = urllib2.Request(site, headers=hdr)
- try:
- page = urllib2.urlopen(req)
- except urllib2.HTTPError, e:
- print e.fp.read()
- content = page.read()
- content = content.split('\n')[41]
- m = hashlib.md5()
- m.update(content)
- if (m.hexdigest() != contentHash):
- notify2.init("Strimi")
- n = notify2.Notification('Strimi!', 'Coś się zmieniło na stronie strimi! Alleluja!')
- n.show()
- print "STRIMI!!!11111"
- check()
- print "Startuję, powiadomię Cię gdy na stronie Strimi zmieni się 42 linijka (informacja o dacie startu)"
Advertisement
Add Comment
Please, Sign In to add comment