Created
December 8, 2012 22:18
-
-
Save Softwave/4242226 to your computer and use it in GitHub Desktop.
GetSource
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 | |
# Get Source | |
# Simple tool to fetch the sourcecode of a website from the command line | |
# by Softwave 2012 | |
# License: Public Domain | |
import easygui as eg | |
import urllib | |
import sys | |
# Variables | |
protocol = "http://" | |
inputURL = "" | |
# If "http://" isn't in URL, add it | |
if not protocol in sys.argv[1]: | |
inputURL = protocol | |
inputURL += sys.argv[1] # Add actual url to string | |
f = urllib.urlopen(inputURL) # Open URL | |
scode = f.read() # Read URL source | |
f.close() # Close stream | |
# Show source | |
eg.codebox(msg=inputURL, title='Get Source', text=scode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment