Giter Club home page Giter Club logo

redgifs's People

Contributors

anytarseir67 avatar davidalvarezr avatar mrkomododragon avatar prb0t avatar scrazzz 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

redgifs's Issues

`examples/download_user.py` not downloading the last page

Summary

examples/download_user.py not downloading the last page

Reproduction Steps

Download one user with it.

Expected Result

All files are downloaded.

Actual Result

It downloads n - 1 pages

System Information

python -m redgifs --version

  • Python v3.11.6-final
  • redgifs v1.7.2-final
  • aiohttp v3.8.6
  • system info: Linux 6.5.8-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Oct 20 15:53:48 UTC 2023

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

This line is the problem: while current_page != total_pages:

I'm using something like this.

    while True:
...
        if current_page <= total_pages:
            # Clear the old gifs from the previous page
            current_page_gifs.clear()
            # Make a new API call to get the gifs from the next page
            data = search(search_term, page=current_page)
            # Update `current_page_gifs` with the new gifs
            current_page_gifs.extend(data.gifs)
        else:
            break

Some `Order` enums doesn't work

Summary

Enums of Order: recent, followers, top28 does not work.

Reproduction Steps

Code snippet: This fails on all of the above Order enums

from redgifs import API, Order

api = API()
api.login()
api.search("search term", order=Order.recent)

Expected Result

Proper result without errors.

Actual Result

redgifs.errors.HTTPException: 400 (Error: {'code': 'BadRequest', 'message': 'wrong order', 'status': 400})

System Information

  • Python v3.10.8-final
  • redgifs v1.6.0-final
  • aiohttp v3.8.3

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

No response

`search_creators` with tag result incomplete and missing entries

Summary

The search_creators with a tag result does not contain all creators that have content with that tag and the creators that are returned are missing entries

The Problem

When using search_creatorswith a tag, the result
a) does not contain all creators that have content with that tag. Like if I search on the website for a tag, the creator of almost every result on the website is not in the API result with the same tag.
b) is missing entries, at least for description and links, those are not filled like they would be if I query a single creator.

The Ideal Solution

search_creators, when called with a tag, should return all creators that have content with that tag. Ideally the result contains a count of content of each creator that matches that tag.
Also the fields links and description should be filled correctly.

The Current Solution

No response

Additional Context

No response

Command line usage does nothing

Summary

Command line usage with a URL does nothing, no error / nothing saved

Reproduction Steps

The example scripts work but the command line usage of 'redgifs [url]' does nothing, tried several search query URLs.

Expected Result

A query output

Actual Result

Nothing

System Information

Window 10 - latest python

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

No response

`data.total` is not always correct while using `Order.best`

Summary

data.totalcan be bigger than the actual number of gifs

Reproduction Steps

Has only failed me so far with the user and sorting from the script below.

Uncomment one of the Test 1/2/3 lines and run

from redgifs import API, Order

api = API()
api.login()

# Search for the user
USERNAME = 'jenovakitty1'

# Test 1 (Works)
# data = api.search_creator(USERNAME, order=Order.new, count=100)

# Test 2 (Fails)
# Output:
# Downloaded 37 out of 157
# total_gifs: 37
# data.total: 157
# total_pages: 2
data = api.search_creator(USERNAME, order=Order.best, count=100)

# Test 3 (Fails)
# Output: (only 31 gifs this time, this user has 6 images so must be related to that)
# Downloaded 31 out of 157
# total_gifs: 31
# data.total: 157
# total_pages: 2
#data = api.search_creator(USERNAME, order=Order.best, count=80)

total_pages = data.pages
current_page = data.page

# This is the total gifs in the `current_page`
total_gifs = data.gifs

while True:
    for i, gifs in enumerate(total_gifs, start=1):
        try:
            # We do the downloading here.
            # Make sure you have a folder called "downloads" in the current directory or else make a new one.
            # api.download(gifs.urls.hd, f'downloads/{i}.mp4')

            # Print a message to keep track of the downloads
            print(f'Downloaded {i} out of {data.total}')

        except Exception as e:
            raise Exception(f'An error occured while donwloading:\n{e}')

    # Update the current page number
    current_page += 1
    if current_page <= total_pages:
        print(f'total_gifs: {str(len(total_gifs))}')
        print(f'data.total: {str(data.total)}')
        print(f'total_pages: {str(total_pages)}')
        # Clear the old gifs from the previous page
        total_gifs.clear()
        # Make a new API call to get the gifs from the next page
        data = api.search_creator(USERNAME, page=current_page)
        # Update `total_gifs` with the new gifs
        total_gifs.extend(data.gifs)
    else:
        break

print('Completed!')

Expected Result

All tests detect 37 gifs in one page and finish correctly.

Actual Result

Test 2 and 3 detect 157 instead of 37 total gifs and fail as a result.

System Information

  • Python v3.11.6-final
  • redgifs v1.7.2-final
  • aiohttp v3.8.6
  • system info: Linux 6.5.10-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 2 19:59:55 UTC 2023

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

No response

`Tags.search()` fails on new tags.

Summary

Tags.search() fails on new tags from get_tags() method.

Reproduction Steps

Make a request with a tag in search() which isn't available in the Tags enum.

Expected Result

Proper SearchResult response.

Actual Result

InvalidTag error. Which shouldn't happen because it's a valid tag. The tag was from the RedGifs API and not from the hardcoded tags in the library.

System Information

v1.6.0

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

I'm opening this issue so that I can fix it when I get the time.

Add support for using client token auth

Summary

i would like to use other tokens than guest to aviod exceeding limits

The Problem

the redgifs documentation suggests a stringent limit for temporary tokens. https://github.com/Redgifs/api/wiki/Temporary-tokens. using other tokens would solve this

The Ideal Solution

ideally both client and user tokens (probably by login) would be able to be used. but user tokens would be good enough

The Current Solution

current solution is to not use this package and implement the auth flow

Additional Context

No response

`count` and `page` params for search broken

Summary

The count and page params for the search() method is broken.

Reproduction Steps

Invoking these won't work

api.search('...', count=1, page=3)
api.search('...', count=1)
api.search('...', page=3)

Expected Result

The final proper SearchResult object

Actual Result

Bad request error with 400 status code

System Information

N/A

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

I'm opening this issue so that I can fix it later when I get the time.

Search using tags example

Summary

Create an example of how to search using one or more tags

The Problem

The docs tell me that an instance of Tags can be used for searching.
search_text (str) โ€“ The GIFs to search for. Can be a string or an instance of [Tags]

I tried a few things but I'm unable to create an instance of Tags.

The Ideal Solution

Create an example of how to do this.

The Current Solution

No response

Additional Context

No response

Orders latest and oldest not working

Summary

Both give an AttributeError

Reproduction Steps

Silly script for testing

from redgifs import API, Order
order = Order.latest
order = Order.oldest
order = Order.best
order = Order.new
order = Order.recent
order = Order.top28
order = Order.trending

I just saw there are test for the orders

Expected Result

Working like the other ones, or being removed from the documentation.

Actual Result

Traceback (most recent call last):
  File "/opt/server/bin/redgifs_batch_downloader.py", line 44, in <module>
    order = Order.oldest
            ^^^^^^^^^^^^
  File "/usr/lib64/python3.11/enum.py", line 784, in __getattr__
    raise AttributeError(name) from None
AttributeError: oldest

System Information

> python -m redgifs --version
- Python v3.11.6-final
- redgifs v1.7.2-final
- aiohttp v3.8.6
- system info: Linux 6.5.8-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Oct 20 15:53:48 UTC 2023

BTW the github recomended command (python -m redgifs -v) for getting this info shows:
redgifs: error: unrecognized arguments: -v

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

No response

No sound on downloaded media

Summary

When using the cli-tool the downloaded media has no sound

Reproduction Steps

In terminal: redgifs <media_url>

Expected Result

Download the Media as a mp4 with sound

Actual Result

Download the Media as a mp4 without sound

System Information

redgifs --version

  • Python v3.10.9-final
  • redgifs v1.7.2-final
  • aiohttp v3.8.6
  • system info: Darwin 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

No response

Upload support

Are there currently any plans to add upload support to the lib?

The problem with the random method

Hello! Faced some problems with the random method. The following error appears:

'local variable 'st' referenced before assignment'

api = redgifs.API()
result = api.search(
Tags.random(count=1),
order=Order.best,
count=72,
page=input()
)

Error "Invalid RedGifs URL"

Summary

The program gives an error when loading a file

Reproduction Steps

Trying to download a file using ID according to instruction. Instead of loading the file, the program gives aTypeerror. It appeared recently, a week ago everything was downloaded correctly.
Does not work even with the example from the repository /examples/download.py. Probably some changes on RedGifs site.

Expected Result

Downloading a file

Actual Result

issue1

System Information

  • Python v3.10.7-final
  • redgifs v1.5.0-alpha
    • redgifs metadata: v1.5.1
  • aiohttp v3.7.4.post0
  • system info: Linux 5.19.0-31-generic #32-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 20 15:20:08 UTC 2023

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

No response

Mass Downloader

Summary

if i want to download all video from one user i cant,

The Problem

if i want to do mass download then i have give all videos links.

The Ideal Solution

IF you upload mass downloaded

For Ex: This https://www.redgifs.com/users/XXXX if this user have 400 GIFS

then i want to download all in once. this can make easy.

The Current Solution

No response

Additional Context

No response

--list option exits after 1st file is downloaded

Summary

If you specify a file with a list of redgif URLs, the first URL is downloaded, then the program exits.

Reproduction Steps

redgifs --list <file_with_urls>

Expected Result

Content of each URL in the NL-delimited file to be downloaded in a separate file in the current working directory.

Actual Result

Only 1st file in the list is downloaded, then the program exits with no error.

System Information

 >python -m redgifs --version
- Python v3.11.6-final
- redgifs v1.8.0-final
- aiohttp v3.9.1
- system info: Windows 10 10.0.22621

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

Culprit appears to be the premature exit(0) after the "Download Complete" message is printed in the main "do_dl" function.

If you remove / comment that line, the "--list" functionality works as expected.

HTTPException 401 when using api.get_gif()

Summary

A couple days ago, the redgifs API started giving a 401 exception when calling api functions.

Reproduction Steps

import redgifs, os
api = redgifs.API()
url = input() # Full url of redgifs video
result = api.get_gif(url.split('/')[-1])
response = api.download(result.urls.hd, os.path.join(path ,dir, name + ".mp4"))
api.close()

Expected Result

Code executes and video is downloaded.

Actual Result

Traceback (most recent call last):
File "/path/to/file.py", line 26, in
result = api.get_gif(sub.url.split('/')[-1])
File "/path/to/site-packages/redgifs/api.py", line 92, in get_gif
json: Dict[str, Any] = self.http.get_gif(id)['gif']
File "/path/to/site-packages/redgifs/http.py", line 123, in get_gif
return self.request(r, **params)
File "/path/to/site-packages/redgifs/http.py", line 111, in request
raise HTTPException(r, js)
redgifs.errors.HTTPException: 401 (Error: {'code': 'MissingAuthorizationHeader', 'description': 'authorization required to access this service', 'docs': 'https://github.com/Redgifs/api/wiki/API-access'})

System Information

  • Python v3.9.14-final
  • redgifs v1.3.1-final
  • aiohttp v3.8.2
  • system info: Darwin 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

The code used to work a couple days ago, but suddenly stopped working.

Bad request signature.

Summary

When trying to open hd/sd links in browser they give: Bad request signature error

Reproduction Steps

  • tried getting gifs with search/search_gifs/get_trending_gifs etc functions
  • opened hd link in browser gave bad request signature error
  • tried sd link same issue
  • tried vthumbnail same issue

Expected Result

Expected: A video/mp4 file

Actual Result

Bad request signature.

System Information

  • Python v3.10.5-final
  • redgifs v1.9.0-final
  • aiohttp v3.8.4
  • system info: Windows 10 10.0.19045

Checklist

  • I have searched all open and closed issues for any duplicates.

Additional Information

No response

API.download() hanging

When downloading multiple files with API.download(), it seems to pause without an exception, causing the program to halt.

Maybe it's something related to http.get() with default timeout very large.

This issue doesn't seem to happen with same link when retrying the program again, but some other link usually gets stuck. All the links used are generated from api.get_gif(rid).urls.hd

Is there a way to skip a file from downloading when time consumed by it is too high?

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.