Page 1 of 3 123 LastLast
Results 1 to 25 of 66
Like Tree14Likes
  1. Thread Author  Thread Author    #1  

    Default Python script to notify you the minute the Nexus 4 page goes on sale

    So I wrote a quick python script this morning that I will leave running all day that will check both the Nexus 8GB and Nexus 16GB pages to see if anything on the pages has changed (MD5 Hash). If it has, it will email you as soon as the page changes. I wrote this so I don't have to sit there all day killing my F5 key. Here's the code:

    Code:
    import urllib
    import hashlib
    import time
    import smtplib
    import string
    
    google_pages = {'https://play.google.com/store/devices/details?id=nexus_4_8gb':'6563c52c9711cb614c9daffdc9c55ee5', 'https://play.google.com/store/devices/details?id=nexus_4_16gb':'1aab1c70346b85075c0c63166c044eb7'}
    
    count = 0
    
    while True:
    	count += 1
    	if not count % 60:
    		print 'Ran: %s' % count
    	time.sleep(30)
    	for google_page in google_pages.keys():
    		page_file = urllib.urlopen(google_page)
    		page_html = page_file.read()
    		page_md5 = hashlib.md5(page_html).hexdigest()
    		if page_md5 != google_pages[google_page]:
    
    			#MAKE SURE TO REPLACE THE LINE BELOW WITH YOUR EMAIL
    			email = 'youremail@example.com'
    
    			server = smtplib.SMTP('localhost')
    
    			msg = string.join((
    				"From: %s" % email,
    				"To: %s" % email,
    				"Subject: %s" % 'NEXUS 4 ON SALE',
    				"",
    				"NEXUS 4 ON SALE! MD5 %s DOES NOT MATCH %s\n\n%s" % (page_md5, google_pages[google_page], google_page)
    				), "\r\n")
    
    			server.sendmail(email, email, msg)
    			server.quit()
    			exit()
  2. #2  
    squadz's Avatar

    Posts
    156 Posts
    Global Posts
    271 Global Posts

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Not to take away from what you did (I thought of doing the same with a PHP app), but Chrome has something like this in an app already.

    Here: Small tip for those staying up tonight...
    Thanked by:
    bilago 
  3. Thread Author  Thread Author    #3  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Quote Originally Posted by squadz View Post
    Not to take away from what you did (I thought of doing the same with a PHP app), but Chrome has something like this in an app already.

    Here: Small tip for those staying up tonight...
    Cool, good to know. I just whipped that little script up in about 5 min...I am a python programmer as my day job, and I thought this would be a more productive use of my time than getting distracted from my work constantly throughout the day. Thanks for the tip though! I am sure that plugin will help the non-programmers out there.

    -Blake
  4. #4  
    marty331's Avatar

    Posts
    47 Posts
    Global Posts
    48 Global Posts

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    BC
    Any tutorials you would recommend to learn Python?

    Sent from my SGH-I997 using Android Central Forums
  5. Thread Author  Thread Author    #5  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Quote Originally Posted by marty331 View Post
    BC
    Any tutorials you would recommend to learn Python?

    Sent from my SGH-I997 using Android Central Forums
    I just started in python over a year ago and read this book:

    I was coming from PHP and had some experience in C/C++ and Java. Good read for learning the syntax and structure of Python.

    Other recommendations here:
  6. #6  
    mzanette's Avatar
    Zee

    Posts
    621 Posts
    Global Posts
    622 Global Posts

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    LOL, ok this is a bit over the top. Do we need to order this the minute it goes on sale?
  7. Thread Author  Thread Author    #7  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    You may not, but I do. This is the first phone I have bought since the 3GS came on sale...and I am really excited for it.
  8. #8  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Quote Originally Posted by mzanette View Post
    LOL, ok this is a bit over the top. Do we need to order this the minute it goes on sale?
    obviously no one NEEDS to. But why not do it anyway?
  9. #9  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    I hope it lives up to your expectations because this is getting ridiculous.
    TheLibertarian likes this.
  10. #10  
    mzanette's Avatar
    Zee

    Posts
    621 Posts
    Global Posts
    622 Global Posts

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Quote Originally Posted by BCVisin View Post
    You may not, but I do. This is the first phone I have bought since the 3GS came on sale...and I am really excited for it.
    I understand, I just find it funny that people are so excited they need to order this thing the moment it's available. It's just a phone after all. Good luck to you! I wonder if all this hype is truly indicative of how successful the N4 will be or is it just a small bunch of people from Android forums? Would be cool if the Nexus 4 was a huge success.
  11. #11  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Quote Originally Posted by blitz118 View Post
    I hope it lives up to your expectations because this is getting ridiculous.
    why are so many people against a little bit of fun.i bet you go round popping balloons and beating puppies with kittens.
    jbmeicher likes this.
  12. #12  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Quote Originally Posted by mzanette View Post
    I understand, I just find it funny that people are so excited they need to order this thing the moment it's available. It's just a phone after all. Good luck to you! I wonder if all this hype is truly indicative of how successful the N4 will be or is it just a small bunch of people from Android forums? Would be cool if the Nexus 4 was a huge success.
    Id think it proabably just the android forums thing. But hopfully it is GREAT SUCCESS! Maybe add alittle fuel to the fire and make the next one even better
  13. Thread Author  Thread Author    #13  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Ya, I get that this isn't "SUCH" a big deal. Like I wouldn't stand in line over night to get this phone the moment it comes on sale, but since I am an uber nerd and it only took me a few minutes to write that script I thought it would be fun to post it up for any other uber nerds who wanted it. Although I don't think this phone will change my world, I am sure carrying around something better than the 3GS will be a little life changing. I do hope it will be a great success as well, but I really have no idea what demand is. I'm also stoked for the T-Mobile $30/month prepay plan.

    -Blake
    Ricky2009 likes this.
  14. #14  
    mzanette's Avatar
    Zee

    Posts
    621 Posts
    Global Posts
    622 Global Posts

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Quote Originally Posted by BCVisin View Post
    Ya, I get that this isn't "SUCH" a big deal. Like I wouldn't stand in line over night to get this phone the moment it comes on sale, but since I am an uber nerd and it only took me a few minutes to write that script I thought it would be fun to post it up for any other uber nerds who wanted it. Although I don't think this phone will change my world, I am sure carrying around something better than the 3GS will be a little life changing. I do hope it will be a great success as well, but I really have no idea what demand is. I'm also stoked for the T-Mobile $30/month prepay plan.

    -Blake
    This phone will be night and day with that 3GS man. I currently have the iPhone 4 and this feels long in the tooth. I can only imagine the 3GS.
    BCVisin likes this.
  15. #15  
    marty331's Avatar

    Posts
    47 Posts
    Global Posts
    48 Global Posts

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Great! Thank you!

    How do I set up the script you wrote in the beginning of the thread. I'm running Ubuntu.
    BCVisin likes this.
  16. Thread Author  Thread Author    #16  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Copy and paste it into a file in your home directory. I called mine "nexus4_page_check.py" Then open a terminal (it should open you in your home direcotry) and type the command "python nexus4_page_check.py" and hit enter. Leave the terminal open to let it continue running. If you close the terminal, it will stop the script running. It runs in a loop every 30 seconds and outputs the count every 60 times it loops (so every 30 minutes). Here is what mine looks like running in a terminal right now:

    Code:
    blake@blake-M4600:~/workspace/ovg$ python nexus4_page_check.py 
    Ran: 60
    Ran: 120
    Ran: 180
    Ran: 240
    (it has been running for over 2 hours)

    I'm on Ubuntu 12.10

    hope that helps!

    -Blake
  17. Thread Author  Thread Author    #17  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Oh, also you need to change line 23 with your email address:

    Code:
    #MAKE SURE TO REPLACE THE LINE BELOW WITH YOUR EMAIL
    email = 'youremail@example.com'
    Let me know if you need any more help!

    -Blake
  18. #18  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Quote Originally Posted by emcdannell View Post
    why are so many people against a little bit of fun.i bet you go round popping balloons and beating puppies with kittens.
    I'm not against it, its just funny watching people get all excited about the phone. I'm still undecided myself, but I did enter my email address with play store to contact me when the phone is available in case I change my mind. $350 is good price for the phone.
    Ricky2009 likes this.
  19. #19  
    marty331's Avatar

    Posts
    47 Posts
    Global Posts
    48 Global Posts

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Quote Originally Posted by BCVisin View Post
    Oh, also you need to change line 23 with your email address:

    Code:
    #MAKE SURE TO REPLACE THE LINE BELOW WITH YOUR EMAIL
    email = 'youremail@example.com'
    Let me know if you need any more help!

    -Blake

    Awesome! I appreciate your help.
  20. #20  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    If you're in the UK you need to use these values in place of those the OP gave (which I assume were for the US store):

    Code:
    google_pages = {'https://play.google.com/store/devices/details?id=nexus_4_8gb':'
    c6ffd72027eb76ef451249af697144ad', 'https://play.google.com/store/devices/detail
    s?id=nexus_4_16gb':'ead983f8873540b866b7670a86b90b4f'}
    Script running on my Raspberry Pi - I'll leave it there all night and set up a filter to ping the email notification extra loud if the subject is Nexus!
  21. Thread Author  Thread Author    #21  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Quote Originally Posted by c_hri_s View Post
    If you're in the UK you need to use these values in place of those the OP gave (which I assume were for the US store):

    Code:
    google_pages = {'https://play.google.com/store/devices/details?id=nexus_4_8gb':'
    c6ffd72027eb76ef451249af697144ad', 'https://play.google.com/store/devices/detail
    s?id=nexus_4_16gb':'ead983f8873540b866b7670a86b90b4f'}
    Script running on my Raspberry Pi - I'll leave it there all night and set up a filter to ping the email notification extra loud if the subject is Nexus!
    Thanks Chris,

    You are correct in the fact that the URL and page I posted is the US version. Thanks for getting the other's the MD5's for the UK! So that confirms that the US and UK sites are different. That means that the times they release the ability to order could be different for US/UK/AU.

    -Blake
  22. #22  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    It'll be the price - we use the same URL but it directs to a country specific page. We see the device priced in GBP not USD.
  23. Thread Author  Thread Author    #23  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Just got the alert, but I see no way to order it. Guess they are prepping for launch. The updated MD5's are:

    Code:
    google_pages = {'https://play.google.com/store/devices/details?id=nexus_4_8gb':'535ae9c50d6448021c806eb5308c38d3', 'https://play.google.com/store/devices/details?id=nexus_4_16gb':'3d43313ef3607e5758c5a7c9f61f1d87'}
  24. #24  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    LOL. Internet high 5 for this man.

    I'm doing it a bit differently with lynx, the cat command, and grep. Your way is much more efficient
    ಠ_ಠ
    제리
  25. Thread Author  Thread Author    #25  

    Default Re: Python script to notify you the minute the Nexus 4 page goes on sale

    Quote Originally Posted by Jerry Hildenbrand View Post
    LOL. Internet high 5 for this man.

    I'm doing it a bit differently with lynx, the cat command, and grep. Your way is much more efficient
    Nice, at least you know how to use GNU tools!
Page 1 of 3 123 LastLast

Similar Threads

  1. Technically isn't it incorrect to say you are hacking the GNex?
    By CarryMe in forum Verizon Galaxy Nexus Rooting, ROMs, and Hacks
    Replies: 10
    Last Post: 01-04-2012, 08:50 AM
  2. Are you able to use bluetooth while in the car dock?
    By katrina2475 in forum Motorola Droid X
    Replies: 14
    Last Post: 09-14-2010, 07:11 AM
  3. Way to kill off the EVO:( Sprint & HTC this is on you!!!
    By widdlewade in forum HTC EVO 4G Rooting, ROMs, and Hacks
    Replies: 30
    Last Post: 08-26-2010, 07:03 PM
  4. How to unroot so you can download the official froyo when it comes out
    By Murraysj09 in forum Incredible Rooting, ROMs, and Hacks
    Replies: 30
    Last Post: 07-27-2010, 09:07 PM
  5. Replies: 3
    Last Post: 01-29-2010, 04:55 PM

Posting Permissions

B