Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redgifs [error] HttpError: '401 Unauthorized' #3037

Closed
jadedgnome opened this issue Oct 11, 2022 · 5 comments
Closed

Redgifs [error] HttpError: '401 Unauthorized' #3037

jadedgnome opened this issue Oct 11, 2022 · 5 comments

Comments

@jadedgnome
Copy link

jadedgnome commented Oct 11, 2022

gallery-dl https://www.reddit.com/user/-GoblinMode- -d '-GoblinMode-' -v
[gallery-dl][debug] Version 1.23.2
[gallery-dl][debug] Python 3.8.3 - Windows-10-10.0.17763-SP0
[gallery-dl][debug] requests 2.27.1 - urllib3 1.26.8
[gallery-dl][debug] Starting DownloadJob for 'https://www.reddit.com/user/-GoblinMode-'
[reddit][debug] Using RedditUserExtractor for 'https://www.reddit.com/user/-GoblinMode-'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): oauth.reddit.com:443
[urllib3.connectionpool][debug] https://oauth.reddit.com:443 "GET /user/-GoblinMode-/.json?limit=100&raw_json=1 HTTP/1.1" 200 5056
[redgifs][debug] Using RedgifsImageExtractor for 'https://redgifs.com/watch/consideratedeficienthawaiianmonkseal'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): api.redgifs.com:443
[urllib3.connectionpool][debug] https://api.redgifs.com:443 "GET /v2/gifs/consideratedeficienthawaiianmonkseal HTTP/1.1" 401 172
[redgifs][error] HttpError: '401 Unauthorized' for 'https://api.redgifs.com/v2/gifs/consideratedeficienthawaiianmonkseal

OR

gallery-dl https://redgifs.com/watch/consideratedeficienthawaiianmonkseal -d '-GoblinMode-' -v
[gallery-dl][debug] Version 1.23.2
[gallery-dl][debug] Python 3.8.3 - Windows-10-10.0.17763-SP0
[gallery-dl][debug] requests 2.27.1 - urllib3 1.26.8
[gallery-dl][debug] Starting DownloadJob for 'https://redgifs.com/watch/consideratedeficienthawaiianmonkseal'
[redgifs][debug] Using RedgifsImageExtractor for 'https://redgifs.com/watch/consideratedeficienthawaiianmonkseal'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): api.redgifs.com:443
[urllib3.connectionpool][debug] https://api.redgifs.com:443 "GET /v2/gifs/consideratedeficienthawaiianmonkseal HTTP/1.1" 401 172
[redgifs][error] HttpError: '401 Unauthorized' for 'https://api.redgifs.com/v2/gifs/consideratedeficienthawaiianmonkseal

But when I tried downloading the redgifs account that the links belongs to, it works.

gallery-dl https://www.redgifs.com/users/vivatheunderdog -d '-GoblinMode-' -v
[gallery-dl][debug] Version 1.23.2
[gallery-dl][debug] Python 3.8.3 - Windows-10-10.0.17763-SP0
[gallery-dl][debug] requests 2.27.1 - urllib3 1.26.8
[gallery-dl][debug] Starting DownloadJob for 'https://www.redgifs.com/users/vivatheunderdog'
[redgifs][debug] Using RedgifsUserExtractor for 'https://www.redgifs.com/users/vivatheunderdog'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): api.redgifs.com:443
[urllib3.connectionpool][debug] https://api.redgifs.com:443 "GET /v2/users/vivatheunderdog/search?order=best&page=1 HTTP/1.1" 200 4116
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): thumbs4.redgifs.com:443
[urllib3.connectionpool][debug] https://thumbs4.redgifs.com:443 "GET /AnimatedWhimsicalKestrel.mp4?expires=1665500400&signature=4942902a975dbe4b8d7888ea147bc7191797f23d4eb32042e5d0763dad8e4256&for=IPADDRESS HTTP/1.1" 200 45609997

  • '-GoblinMode-'\redgifs\vivatheunderdog\redgifs_animatedwhimsicalkestrel.mp4
@chio0hai
Copy link
Contributor

yt-dlp has a solution: yt-dlp/yt-dlp#4805

@jadedgnome
Copy link
Author

jadedgnome commented Oct 13, 2022

yt-dlp has a solution: yt-dlp/yt-dlp#4805

yeah, it's missing the ability to grab oauth tokens from gif urls but the user urls are able to get them.

I don't know what i'm doing.. i'm going to copy and paste and hope for the best. 🤞

@ghost
Copy link

ghost commented Oct 13, 2022

It's going to need an updated bearer token now, even if we embed the current one, it'll expire next week. I've got a PR ready as a fix for this, but not sure what to do about the bearer.

mikf added a commit that referenced this issue Oct 13, 2022
send public Bearer token as 'authorization' header
mikf added a commit that referenced this issue Oct 13, 2022
@mikf
Copy link
Owner

mikf commented Oct 13, 2022

even if we embed the current one, it'll expire next week

That's good to know. Thanks for the info.
I initially just used the current token as authorization header (e974c75) and hoped it wouldn't get updated all that often.
With commit ed55bd3 it now fetches the token from the redgifs website, similar to yt-dlp, and caches it for one hour.

@jadedgnome
Copy link
Author

@mikf

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants