Login Register






Website Copier filter_list
Author
Message
Website Copier #1
This is really simple and easy to make. There are only a few problems and they will be listed at the end.

How does this work?
Basically, it finds your target website, decodes it and writes it toan HTML file.

What does it not do?
  • Save images.
  • Save external CSS
  • Write to file IF there is a special character in the file. Ex: \u253c

The only needed imports for this file is urllib, and sys. Any others are quite useless to us.

Code:
import urllib,sys

Next we just check the version of the user, if it is greater than version 2, it imports urllib.request as urlreq. If not, urllib2 is imported as urlreq.

Code:
if sys.version_info[0] > 2: import urllib.request as urlreq else: import urllib2 as urlreq

Now we prompt the user for their target.

Code:
target = input('Website: ')

Now that we've prompted the user, we need to build our path name, the name of the file that we save, and our website request that will tell us which website to steal the HTML from.

Code:
request = 'http://' website = (request + target) auto_path = target + '/' path_name = (target.replace('.','') + '.html').replace('/','')

All we have to do now is open the website and save it to an HTML file.

The next few lines of code just open the website.

Code:
open_web = urlreq.urlopen(website) read = str(open_web.read().decode())

It's time to save your ripped/stolen/peanut buttered website.

Code:
f = open(path_name,'w') f.write(read) f.close() print('Saved.')

We're finished.

Problems and caveats:
  • Special characters cause the entire project to fail. Ex: \u253c

Full code:
Code:
import urllib,sys if sys.version_info[0] > 2: import urllib.request as urlreq else: import urllib2 as urlreq target = input('Website: ') request = 'http://' website = (request + target) auto_path = target + '/' path_name = (target.replace('.','') + '.html').replace('/','') open_web = urlreq.urlopen(website) read = str(open_web.read().decode()) f = open(path_name,'w') f.write(read) f.close() print('Saved.')
[Image: BXqGARG.png]

Reply





Messages In This Thread
Website Copier - by Equinox - 03-09-2014, 03:38 AM
RE: Website Copier - by BreShiE - 03-09-2014, 05:09 AM
RE: Website Copier - by Oni - 03-09-2014, 08:45 AM
RE: Website Copier - by Eclipse - 03-09-2014, 08:48 AM
RE: Website Copier - by Equinox - 03-09-2014, 08:49 AM
RE: Website Copier - by Eclipse - 03-09-2014, 08:51 AM
RE: Website Copier - by Equinox - 03-09-2014, 08:53 AM
RE: Website Copier - by Eclipse - 03-09-2014, 08:59 AM