Skip to content

Instantly share code, notes, and snippets.

@nate-moo
Last active June 5, 2021 03:26
Show Gist options
  • Save nate-moo/421ffe01575f8abd1d9792b50dcd0a16 to your computer and use it in GitHub Desktop.
Save nate-moo/421ffe01575f8abd1d9792b50dcd0a16 to your computer and use it in GitHub Desktop.
Quick and Dirty uploader for catbox.moe

catbox.moe and litterbox.catbox.moe easy uploader

It is very simple to use.

  1. Download the python script
  2. Install the packages listed in requirements.txt (or use this command: pip3 install requests pyperclip)
  3. Move the python script to somewhere like your desktop
  4. Any file under 200mb (or under 1 Gb if using litterbox, see below) can be dragged and dropped onto the python script and uploaded (except : .exe, .scr, .cpl, .doc*, .jar, and any others mentioned in their FAQ)
  5. The uploaded file link is now in your clipboard (link copies automatically)

Note: This can also be used similarly to a CLI app, The only arg taken is the file path to the desired file

Configuration:

In the options dictionairy there are the following configurable options:

litterbox - Set this to True if you want to use litterbox for bigger files (up to 1 Gb)

time - when litterbox is True use this to choose the time length of the file being viewable

pyperclip==1.8.2
requests==2.25.1
import requests
import sys
from pyperclip import copy
def main():
try:
try:
droppedFile = sys.argv[int(1)]
f = open(droppedFile, 'rb')
except:
input("Nothing was dropped")
exit()
data = {
"reqtype": "fileupload"
}
options = {
"litterbox": False,
"litterboxOptions": {
"reqtype": "fileupload",
"time": "1h" # viable options are: 1h, 12h, 24h, 72h
}
}
if options["litterbox"]:
r = requests.post("https://litterbox.catbox.moe/resources/internals/api.php",
files={'fileToUpload': f}, data=options["litterboxOptions"])
else:
r = requests.post("https://catbox.moe/user/api.php",
files={'fileToUpload': f}, data=data)
print(r.text)
copy(r.text)
input()
except Exception as e:
print(e)
input()
exit()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment