Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import smtplib
- import urllib2
- import random
- import re
- import time
- #panou de configurare
- email = "" #unde vrei sa primesti ofertele
- smtp = "my.inbox.com"
- loginuser = "@inbox.com"
- loginpass = ""
- <span class="highlight">chilipir</span> = 25 #pretul(ron) sub care sunteti anuntat
- interval_timp_cautare = 600 # in secunde
- print r"""
- #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#\
- #.........RSTforums.com........#-\
- #.............Usr6.............#--\/
- #...Cautatoru de chilipiruri...#--/\
- #..............................#-/
- #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#/
- """
- def email_sender(TEXT):
- #print TEXT
- message = 'To:' + email + '\n' + 'From: ' + loginuser + '\n' + 'Subject:Chilipir \n\n' + TEXT
- server = smtplib.SMTP(smtp, 587)
- server.login(loginuser, loginpass )
- server.sendmail(loginuser, email, message)
- server.quit()
- print "Oferta a fost expediata"
- return
- expediate = []
- while True :
- expediat = ""
- random_nr = str(random.randint(10**16,99999999999999999))
- ua = "Opera/%s.%s (Windows NT %s.%s) Presto/%s.%s.%s Version/%s.%s" \
- %(random_nr[0], random_nr[1:3], random_nr[4], random_nr[5], random_nr[6], random_nr[7:9], random_nr[10:13], random_nr[13:15], random_nr[15:17])
- try:
- site = "http://www.emag.ro/resigilate/sort-priceasc"
- req = urllib2.Request(site, None, {'User-Agent' : ua})
- continut = urllib2.urlopen(req, timeout=30).read()
- match = re.findall('\"money-int\"\>(\d*)\<\/span\>\<sup class=\"money-decimal\"\>\d*.+\n.+\t+.+\n\t.+\n.+\n.+\<a href=\"(.+#resigilate)"',continut)
- for every in match:
- pret, link = every
- if int(pret) <= <span class="highlight">chilipir</span>:
- link = "http://www.emag.ro" + link
- unic = str(pret) + link
- if unic not in expediate:
- expediat += str(pret) + "\t" + link +"\n"
- expediate.append(unic)
- except Exception as E:
- email_sender(str(E))
- if len(expediat) >= 1:
- email_sender(expediat)
- time.sleep(interval_timp_cautare)
- print time.strftime("%c"), "nimic nou"
- exit()
- priN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement