multipaste.py

A simple script to post the same message to several pastebin sites. Not all of them are working at this point, feel free to improve it. Requires mechanize.

Installation instructions

On Linux, save the script as /bin/multipaste. On Windows, just put the script in a folder somewhere where you will run it later (proper functioning is not guaranteed on Windows).

Usage instructions

multipaste.py takes input from STDIN. This means you can simply do something like cat mymessage.txt | multipaste to post the contents of mymessage.txt to various Pastebin sites. On Windows, this would be type mymessage.txt | python multipaste.py (assuming the script is called multipaste.py).

The script

multipaste.py
#!/usr/bin/python
 
import sys, mechanize
 
def by_nr(message, url, number, field):
	br = mechanize.Browser()
	br.set_handle_robots(False)
	br.open(url)
	br.select_form(nr=number)
	br[field] = message
	result = br.submit()
	return result.geturl()
 
def by_name(message, url, formname, field):
	br = mechanize.Browser()
	br.set_handle_robots(False)
	br.open(url)
	br.select_form(name=formname)
	br[field] = message
	result = br.submit()
	return result.geturl()
 
message = ''.join(sys.stdin.readlines())
 
print "Posting your message to various pastebin services.."
 
print "pastee.org: " + by_nr(message, "http://www.pastee.org/", 0, "content")
print "dpaste.org: " + by_nr(message, "http://www.dpaste.org/", 0, "content")
#print "codeupload.com: " + by_nr(message, "http://www.codeupload.com/", 1, "source")  #can't find the field, not sure why
#print "codepad.org: " + by_nr(message, "http://www.codepad.org/", 0, "code")  #server error... tries to execute?
print "dumpz.org: " + by_nr(message, "http://www.dumpz.org/", 0, "code")
#print "hpaste.org: " + by_nr(message, "http://www.hpaste.org/", 0, "paste")  #needs more fields
print "mysticpaste.com: " + by_nr(message, "http://www.mysticpaste.com/", 0, "content")
print "stickypaste.com: " + by_nr(message, "http://www.stickypaste.com/", 0, "code")
 
print "pastebin.com: " + by_name(message, "http://www.pastebin.com/", "myform", "paste_code")
print "dpaste.com: " + by_name(message, "http://www.dpaste.com/", "pasteform", "content")
#print "clippy.tk: " + by_name(message, "http://www.clippy.tk/", "editor", "code2")  # needs more work too
#print "pastebay.com: " + by_name(message, "http://www.pastebay.com/", "editor", "code2")  #idk why this doesn't work
projects/multipaste.txt · Last modified: 2012/04/02 14:19 by joepie91
Back to top
CC Attribution 3.0 Unported
Donate Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0