Skip to content

CLI and Python package for uploading files to multiple file hosting services, automatically trying the next hoster on failure

License

Notifications You must be signed in to change notification settings

c-kr/multi_hoster_uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi Hoster Uploader

Multi Hoster Uploader serves as both a command-line tool and a Python package for uploading files to multiple file hosting services. It enables easy and efficient file uploads to various hosting services by trying them in a predefined or random order. If one hoster fails for any reason, the next hoster in the list is tried.

Table of Contents

Hoster Status

Hoster Status
FileIo Favicon FileIo FileIO
Gofile Favicon GoFile GoFile
KeepSh KeepSh

Installation

  1. Clone this repository:
    git clone https://github.com/c-kr/multi_hoster_uploader.git
  2. Change into the project directory:
    cd multi_hoster_uploader
  3. Install the required packages:
    pip install -r requirements.txt
  4. Optionally symlink the CLI Tool to your PATH
    ln -s /path/to/multi_hoster_uploader/multi_hoster_uploader ~/.local/bin/multi_hoster_uploader

Usage

Upload a file using the default hosters and order:

multi_hoster_uploader --file /path/to/your/file.txt

Upload a file using a random hoster order:

multi_hoster_uploader --file /path/to/your/file.txt --random-hoster

To modify the default hoster sequence, adjust the HOSTERS variable within the multi_hoster_uploader file.

Using MultiHosterManager in Your Own Script

To use the MultiHosterManager class in your own script, follow these steps:

  1. Import the MultiHosterManager class and the hoster classes you want to use:
from hoster import MultiHosterManager
from hoster.hosters import FileIoHoster, GofileHoster, KeepShHoster

Instantiate the MultiHosterManager class with the list of hoster classes and, optionally, a flag to randomize the hoster order:

manager = MultiHosterManager([FileIoHoster, GofileHoster, KeepShHoster], random_hoster=True)

Call the upload method of the MultiHosterManager instance, providing the file path as an argument:

download_url = manager.upload('/path/to/your/file.txt')

Developing Custom Hoster Classes

To develop custom hoster classes, follow these steps:

  1. Create a new Python file for your custom hoster class in the hoster/hosters directory.
  2. Import the Hoster base class from hoster.base_hoster.
  3. Create a new class that inherits from Hoster and implement the required methods, such as upload and process_response.
  4. Add your custom hoster class to the HOSTERS list in the multi_hoster_uploader script.
  5. Extend Unittest, Github Workflow and README.md
  6. Open a Github Pull Request if you want to share your hoster class

For more information on creating custom hoster classes, refer to the existing hoster classes in the hoster/hosters directory.

Acknowledgments

I would like to acknowledge the contribution of GPT-4 by OpenAI in the development of various parts of the Multi Hoster Uploader.

License

MIT

About

CLI and Python package for uploading files to multiple file hosting services, automatically trying the next hoster on failure

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages