Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Trying to make a script to scan a webpage

I have no idea where to start as i'm new to python. (I know the basics though.)

Here is some psuedo-code to help understand what I want to do.


Go to [webpage]
Refresh [webpage] every 10 seconds
if a certain number value is found, email me (repeatedly) [meaning for each unique value it finds, email me]
else, keep refreshing
psuedo-code

PHP Code

<?php 
import urllib
import time
import re
import smtplib

def gmail
( info):
  
/*SEND INFO*/


while True:
    
data = urllib.open("URL").read()
    
unique = re.findall("REGEXFORVALUE", data)
    for 
x in unique:
         
gmail( x)
   
time.sleep(10) 
(Oct 26, 2015 10:57 AM)SIM-1866423 Wrote:  psuedo-code

PHP Code

<?php 
import urllib
import time
import re
import smtplib

def gmail
( info):
  
/*SEND INFO*/


while True:
    
data = urllib.open("URL").read()
    
unique = re.findall("REGEXFORVALUE", data)
    for 
x in unique:
         
gmail( x)
   
time.sleep(10) 

Thank you so much! Question, under "SEND INFO" I don't exactly know what to put. Say my email was [email protected], how would I go about it?
check smtplib lib on google, you will understand
Hey maybe my example code here will point you in the right direction.

PHP Code

<?php 
import urllib2
import re

def getreddit
():
    
url = "REDDITDOTCOMHERE/"
    
request = urllib2.Request(url)
    
handle = urllib2.urlopen(request)
    
readhandle = handle.read()
    
readhandlestr = str(readhandle)


    
# Look for any characters in between " <p class="title"><a class="title may-blank ""
    # and " a>' " , that match the regular expression pattern, which is " .+? ".



    
parse1 = re.findall(r'<p class="title"><a class="title may-blank "(.+?)a>', readhandlestr)
    
parse1string = str(parse1)

    
parse2 = re.findall(r'\s>(.+?)</', parse1string)
    for 
text in parse2:
        print 
text



getreddit
() 


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by chrizatorDec 20, 2017 04:33 PM 1 269 Dec 20, 2017 04:33 PM
Last Post: Not Your Average Orange
[Java] by shyamsssMar 15, 2017 08:22 AM 5 373 Mar 15, 2017 08:22 AM
Last Post: Mohinder
[.NET] by Phoenix_101VB.NET_DUDENov 19, 2016 04:14 PM 13 478 Nov 19, 2016 04:14 PM
Last Post: Ninja