I'm a python newbie what I'm trying to do is create two scripts. One that downloads the webpage information and another scripts that downloads links and outputs a summary of the total number of links downloaded into a list.
First script (Download webpage)
import sys, urllib
def getWebpage(url):
print '[*] getWebpage()'
url_file = urllib.urlopen(url)
page = url_file.read()
return page
def main():
sys.argv.append('http://www.funeralformyfat.tumblr.com)
if len(sys.argv) != 2:
print '[-] Usage: webpage_get URL'
return
else:
print getWebpage(sys.argv[1])
if __name__ == '__main__':
main()
Second script (downloads links and outputs a summary of the total number of links downloaded into a list.)
import sys, urllib
def print_links(page):
print '[*] print_links()'
links = re.findall(r'\<a.*href\=.*http\:.+', page)
links.sort()
print '[+]', str(len(links)), 'HyperLinks Found:'
for link in links:
print link
def main():
sys.argv.append('http://www.funeralformyfat.tumblr.com')
if len(sys.argv) != 2:
print '[-] Usage: webpage_links URL'
return
page = webpage_get.getWebpage(sys.argv[1])
print_links(page)
if __name__ == '__main__':
main()
My code runs however it doesn't return any links. Can anyone see the issue?.