Created
November 9, 2012 03:35
-
-
Save RodrigoPrior/4043550 to your computer and use it in GitHub Desktop.
retrieve multiple pages and find string in it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import re,urllib2,urllib | |
list_ids = ( '1', '2', '3') | |
url = 'https://<url>/<path>/file.php?id=' | |
regex = '[0-9]{2}\/[0-9]{11}\-[0-9]' | |
for i in list_ids: | |
link = url + i | |
htmlpage = urllib2.urlopen(link).read() | |
m = re.findall(regex, htmlpage) | |
print "%s;%s" % (i, m[0:1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment