Skip to content

Instantly share code, notes, and snippets.

@Softwave
Created December 8, 2012 22:18
Show Gist options
  • Save Softwave/4242226 to your computer and use it in GitHub Desktop.
Save Softwave/4242226 to your computer and use it in GitHub Desktop.
GetSource
#!/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