Login Register


First ever-made Python script. [Pastebin Extractor] filter_list
Author
Message
First ever-made Python script. [Pastebin Extractor] #1
Ok, so as you'll be able to see..all this does is gives you options to either save, view, or save and view the contents of the pastebin link provided. You can save it to whatever name you like (ex: goon.txt), and it automatically saves the full date in [DATE] after your selected name..

Code:
from bs4 import BeautifulSoup import urllib import threading,time import sys import time import datetime now = datetime.datetime.now() pasteID = raw_input("Enter your pastebin URL:").split('.com/') txtName = raw_input("Assuming, you're going to be saving as well, what would you like to save as?\nhint: no extension needed, auto-saves as a text file\n") print "What would you like to do with this pastebin?\n\n1.) Print entire source\n.2) Save Source\n3.) Both view then save source\n4.) Exit\n" choice = int(raw_input("Please choose (1-4): ")) if choice == 1: URL = urllib.urlopen ("http://pastebin.com/raw.php?i=" + pasteID[1]) html = URL.read() soup = BeautifulSoup("".join(html)) bsoup = soup.findAll("", text =True) print bsoup elif choice == 2: k = open(txtName + now.strftime("[%m-%d-%Y]") + ".txt","w") k.write(html) k.close() print "sucessfully extracted: pastebin.com/" + pasteID[1] elif choice == 3: URL = urllib.urlopen ("http://pastebin.com/raw.php?i=" + pasteID[1]) html = URL.read() soup = BeautifulSoup("".join(html)) bsoup = soup.findAll("", text = True) print bsoup k = open(txtName + now.strftime("[%m-%d-%Y]") + ".txt","w") k.write(html) k.close() print "sucessfully extracted & saved: pastebin.com/" + pasteID[1] elif choice == 4: print "Pastebin extractor, shutting down." time.sleep(3) sys.exit()

Reply

RE: First ever-made Python script. [Pastebin Extractor] #2
Unfortunately AF's [CO DE] tags don't save indents, do you mind uploading to (ignore the irony) pastebin?
[Image: jWSyE88.png]

Reply

RE: First ever-made Python script. [Pastebin Extractor] #3
Yea, not a problem. I'll add it to the thread for ya.

Reply







Users browsing this thread: 1 Guest(s)