Skip to main content

Async and Sync Python Wrapper for the RedGIFs API.

Project description

redgifs

Async and Sync Python Wrapper for the RedGIFs API.


Please star this repo to support the developer and to encourage the development of this project!


Installation

pip install -U redgifs

Development version

pip install -U git+https://github.com/scrazzz/redgifs

redgifs works on Python versions 3.8 and above.


Quickstart

1. Command Line:

Install: pip install redgifs[cli]

$ redgifs --help
Usage: redgifs [OPTIONS] [URLS]...

Options:
  -q, --quality [sd|hd]  Video quality of GIF to download.  [default: hd]
  -d, --dir FOLDER_NAME  The folder/directory to save the downloads to.
  -i, --input PATH       Download URLs from a newline seperated txt file.
  --help                 Show this message and exit.

Examples:

$ # Download files to a folder
$ ls
Home    Downloads  Homework  Music
Backup  Documents  Videos    Games
$ redgifs https://redgifs.com/watch/xyz --q sd --dir Homework
Downloading xyz...
Download complete
$ ls Homework
xyz.mp4
$ # Download GIFs from a file that contains a list of URLs
$
$ # urls.txt:
$ # https://redigfs.com/watch/xyz
$ # https://redigfs.com/watch/qwe
$ # https://redigfs.com/watch/abc
$ # https://redigfs.com/watch/rst

$ redgifs -i urls.txt
Downloading xyz...
Download complete
Downloading qwe...
$ # Download all GIFs from a user's profile
$ mkdir rg_vids
$ redgifs https://redgifs.com/users/usernamethatexists -d rg_vids
Downloaded 1/3 GIFs
Downloaded 2/3 GIFs
Downloaded 3/3 GIFs

Downloaded 3/3 videos of "usernamethatexists" to rg_vids folder sucessfully

2. Synchronous usage:

import redgifs

api = redgifs.API()
api.login() # Login with temporary token
response = api.search('3D')
print(response)
api.close()

3. Asynchronous usage:

import asyncio
from redgifs.aio import API # note this

async def main():
    api = API()
    await api.login() # Login with temporary token
    response = await api.search('3D')
    print(response)
    await api.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

More examples can be found in the examples directory.


Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redgifs-1.9.4.tar.gz (106.4 kB view hashes)

Uploaded Source

Built Distribution

redgifs-1.9.4-py3-none-any.whl (118.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page