Giter Site home page Giter Site logo

nstrydom2 / anonfile-api Goto Github PK

View Code? Open in Web Editor NEW
62.0 4.0 24.0 14.99 MB

An unofficial Python Anonfiles.com API

License: MIT License

Python 72.44% HTML 27.56%
anonfiles pypi python anonfile api rest-client anonfile-api file-upload file-download anonymous

anonfile-api's Introduction

Anonfiles.com Unofficial Python API

PyPI version shields.io CI PyPI download total PyPI pyversions PyPI license

This unofficial Python API was created to make uploading and downloading files from https://anonfiles.com simple and effective for programming in Python. The goal of the project is to create an intuitive library for anonymous file sharing.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Python 3.8+ is required to run this application, other than that there are no prerequisites for the project, as the dependencies are included in the repository.

Installing

To install the library is as simple as running

pip install anonfile

from the command line. To install this library in debug mode with dev dependencies, use

pip install -e .[dev]

instead. It is recommended to create an virtual environment prior to installing this library. If you only intend to use this library from the CLI, use pipx for the installation instead:

pipx install anonfile

Dev Notes

Run unit tests locally:

pytest --verbose -s [--token "REDACTED"]

Add the -k test_* option if you want to test only a single function.

Usage

Import the module and instantiate the AnonFile() constructor. Setting the download directory in path is optional. Using the API token in the constructor is optional as well. A valid token registers all file uploads online, i.e. a list of all uploaded files is made accessible to any user that signs into your account.

from anonfile import AnonFile

anon = AnonFile()

# upload a file and enable progressbar terminal feedback (off by default)
upload = anon.upload('/home/guest/jims_paperwork.doc', progressbar=True)
print(upload.url.geturl())

# download a file and set the download directory
from pathlib import Path
target_dir = Path.home().joinpath('Downloads')
download = anon.download("https://anonfiles.com/9ee1jcu6u9/test_txt", path=target_dir)
print(download.file_path)

And voilà, pain-free anonymous file sharing. If you want more information about the AnonFile API visit anonfiles.com.

Command Line Interface

# open help page for specific commands
anonfile [download|upload|preview|log] --help

# note: both methods expect at least one argument, but can take on more
anonfile download --url https://anonfiles.com/93k5x1ucu0/test_txt
anonfile upload --file ./test.txt

Built With

Versioning

Navigate to tags on this repository to see all available versions.

Authors

Name Mail Address GitHub Profile
Nicholas Strydom [email protected] nstrydom2

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for more details.

Acknowledgments

  • Joseph Marie Jacquard
  • Charles Babbage
  • Ada Lovelace
  • My Dad
  • Hat tip to anyone whose code was used
  • Inspiration
  • etc

anonfile-api's People

Contributors

d4r14h avatar dependabot[bot] avatar hentai-chan avatar nstrydom2 avatar stefangreve avatar thedarkw3b avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

anonfile-api's Issues

The API Doesnt work ?

unsupported operand type(s) for -=: 'tuple' and 'int'
Traceback (most recent call last):
File "c:\users\raptex\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return run_code(code, main_globals, None,
File "c:\users\raptex\appdata\local\programs\python\python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\raptex\AppData\Local\Programs\Python\Python39\Scripts\anonfile.exe_main
.py", line 7, in
File "c:\users\raptex\appdata\local\programs\python\python39\lib\site-packages\anonfile_init
.py", line 37, in main
print(f"URL: {upload.url.geturl()}")
AttributeError: 'NoneType' object has no attribute 'url'

Bye Anonfiles

Hi, I just open this issue to inform to the community that, sadly, after working for years, Anonfiles is closing down:

After trying endlessly for two years to run a file sharing site with user anonymity we have been tired of handling the extreme volumes of people abusing it and the headaches it has created for us.
Maybe it is hard to understand but after tens of million uploads and many petabytes later all work of handling abuse was automated through all available channels to be fast as possible.
We have auto banned contents of hundreds of thousands files.
Banned file names and also banned specific usage patterns connected to abusive material to the point where we did not care if we accidental delete thousands of false positive in this process.
Even after all this the high volume of abuse will not stop.
This is not the kind of work we imagine when acquiring it and recently our proxy provider shut us down.

This can not continue.

Domain 4sale.

[email protected]

Source: https://anonfiles.com/

LetsUpload and FileChan, clones of Anonfiles, will be shut down after a while.

not working with FreeBSD

Running the command anonfile --help on FreeBSD gives the following error message:

Traceback (most recent call last):
  File "/usr/local/bin/anonfile", line 5, in <module>
    from anonfile.__init__ import main
  File "/usr/local/lib/python3.8/site-packages/anonfile/__init__.py", line 12, in <module>
    from .anonfile import *
  File "/usr/local/lib/python3.8/site-packages/anonfile/anonfile.py", line 84, in <module>
    file_handler = logging.FileHandler(get_logfile_path())
  File "/usr/local/lib/python3.8/site-packages/anonfile/anonfile.py", line 75, in get_logfile_path
    config_dir = get_config_dir()
  File "/usr/local/lib/python3.8/site-packages/anonfile/anonfile.py", line 65, in get_config_dir
    return {
KeyError: 'FreeBSD'

unsupported operand type(s) for -=: 'tuple' and 'int'

When I try to upload any file using the CLI (anonfile upload -f 'filename'), it starts the progress bar then fails and says unsupported operand type(s) for -=: 'tuple' and 'int'

Screenshots
image

Desktop Information:

  • OS: Kali GNU/Linux Rolling x86_64
  • Anonfile Version: Latest
  • Kernel: 5.19.0-kali2-amd64
  • Python Version: 3.10.8
  • Terminal: Konsole

I installed this with pip3 the day of writing this

Big files (2GB+) can't be uploaded

Describe the bug
Uploading files bigger than 2GB is not supported as requests.post doesn't support it.

To Reproduce
Steps to reproduce the behavior:

  1. Try to upload a file bigger than 2GB.
  2. Use upload = AnonFile().upload("big.zip", true).
  3. upload is None.
  4. The following output is printed:
Upload: big.zip:   0%|          | 0.00/2.06G [00:00<?, ?B/s]
Upload: big.zip: 100%|○○○○○○○○○○| 2.06G/2.06G [00:01<00:00, 1.71GB/s]
Upload: big.zip: 100%|○○○○○○○○○○| 2.06G/2.06G [00:03<00:00, 664MB/s] 
string longer than 2147483647 bytes

Expected behavior
Files bigger than 2GB should be supported, as anonfiles supports up to 20GB per file.

[*] Error -- Expecting value: line 1 column 1 (char 0)

When I try to upload a file I receive this error, I already tried importing requests, json etc but doens't worked

That's my code:

file_input = input(Fore.LIGHTRED_EX + " [?] What is the file name? (ex: hello.txt): ")
anon = AnonFile('47d3dxxx...')
file_url = anon.upload_file(file_input)

UA should be able to be set in the CLI as an optional arg

Is your feature request related to a problem? Please describe.
No response

Describe the solution you'd like
I want the user to be able to set the User Agent from the command line as an additional optional argument.

Describe alternatives you've considered
No response

Additional context
No response

Poor design

Basically, the design of this python library is awkward and confusing. Consider a refactor.

Connection aborted

[*] Error -- ('Connection aborted.', timeout('The write operation timed out')).
i got this error when i try to upload a mp4 files (when the size is 2Mo the problem arrives). I think is a problem with the requests library ? Do you know how can I specify the time to let the upload finish ?
Thanks !

Proxy args need to be added to the CLI

Is your feature request related to a problem? Please describe.
No response

Describe the solution you'd like
The library has proxy support, however it isn't available for use in the CLI. Just add an
argument that takes a proxy server from the user.

Describe alternatives you've considered
No response

Additional context
You should probably find a way to standardize the proxy server option (http, https, socks, etc). What I mean is, the user should maybe include that proxy protocol in the string or by some other way.

batch file download flag

Add a --batch-file option (similar to youtube-dl) to the download method. This should be implemented as a CLI-only feature.

Api still working ?

stat: path should be string, bytes, os.PathLike or integer, not NoneType
'NoneType' object has no attribute 'url'
Traceback (most recent call last):
File "/home/raveen/.local/lib/python3.8/site-packages/pyrogram/dispatcher.py", line 217, in handler_worker
await handler.callback(self.client, *args)
File "/home/raveen/Desktop/projects/MUltiFilesB/bot.py", line 59, in anon_up
print(upload.url.geturl())
AttributeError: 'NoneType' object has no attribute 'url'

my usage

unsupported operand type(s) for -=: 'tuple' and 'int'

I'm getting an error unsupported operand type(s) for -=: 'tuple' and 'int' recently. Seems like it's caused by SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091) and it's trying to retry the connection or something

Known Issues

  • the upload and download limit caps at around 2MiB/s because of requests_toolbelt (see also: this issue)
  • the CI script broke some time after this commit, though the library still seems to work for the most part

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.