Page 3 of 4

Re: Open subtitles API download issue

Posted: Thu Jan 13, 2022 6:57 pm
by nsgr
Update :
I was so confused cuz i got the problem again. Then i downloaded the python api to see if it get the same error and i got no error...
I compared the requests made by the python api and my curl requests and i found the difference.
The Bearer wasn't the problem. I had to use "https://www.opensubtitles.com/api/v1/download" instead of "https://api.opensubtitles.com/api/v1/download".
I'm not sure why the subdomain "api.opensubtitles.com" results in a 500 Error on the download link for me.

Just wanted to share my experience if others have the same problem.

Re: Open subtitles API download issue

Posted: Fri Jan 14, 2022 6:32 am
by oss
I can not confirm this. Actually it seems "Bearer" is optional, it can be there, but doesn't have to be (for standard, we are putting it there and it SHOULD be there). Try with different file_id and play a bit and I hope you will confirm this

Re: Open subtitles API download issue

Posted: Sun Jan 16, 2022 6:28 pm
by nsgr
I can not confirm this. Actually it seems "Bearer" is optional, it can be there, but doesn't have to be (for standard, we are putting it there and it SHOULD be there). Try with different file_id and play a bit and I hope you will confirm this
Yes, "Bearer" wasn't the problem as stated in my update post. It wasn't working because i used "https://api.opensubtitles.com/api/v1/download". I had to use "https://www.opensubtitles.com/api/v1/download". Not sure why i get the 500 Error with the api.opensubtitles Subdomain tho.

Re: Open subtitles API download issue

Posted: Sun Jan 16, 2022 7:29 pm
by os_dev
I can not confirm this. Actually it seems "Bearer" is optional, it can be there, but doesn't have to be (for standard, we are putting it there and it SHOULD be there). Try with different file_id and play a bit and I hope you will confirm this
Yes, "Bearer" wasn't the problem as stated in my update post. It wasn't working because i used "https://api.opensubtitles.com/api/v1/download". I had to use "https://www.opensubtitles.com/api/v1/download". Not sure why i get the 500 Error with the api.opensubtitles Subdomain tho.
need to track the problem further, "Bearer" is required as described in the docs, and the url to be used must be api.opensubtitles.com, www.opensubtitles.com only work to access the api temporarily and will be disabled in time, so better solve it now.

may I ask, what are you using for testing ?

Re: Open subtitles API download issue

Posted: Sun Jan 16, 2022 10:54 pm
by nsgr
I can not confirm this. Actually it seems "Bearer" is optional, it can be there, but doesn't have to be (for standard, we are putting it there and it SHOULD be there). Try with different file_id and play a bit and I hope you will confirm this
Yes, "Bearer" wasn't the problem as stated in my update post. It wasn't working because i used "https://api.opensubtitles.com/api/v1/download". I had to use "https://www.opensubtitles.com/api/v1/download". Not sure why i get the 500 Error with the api.opensubtitles Subdomain tho.
need to track the problem further, "Bearer" is required as described in the docs, and the url to be used must be api.opensubtitles.com, www.opensubtitles.com only work to access the api temporarily and will be disabled in time, so better solve it now.

may I ask, what are you using for testing ?
I'm just using a small bash script with curl for testing. I just changed the URL back to api.opensubtitles and it works. Maybe it was a typo on my end.
I'm sorry about the confusion and thanks for the help!

Re: Open subtitles API download issue

Posted: Mon Jan 17, 2022 10:06 am
by oss
www.opensubtitles.com SHOULDN'T be used for any API requests.

Re: Open subtitles API download issue

Posted: Thu Feb 10, 2022 9:05 pm
Hello, I am having the same problem. Everything is working fine exept that the download link isn't. For example https://www.opensubtitles.com/download/ ... 352806.srt gives me
"Error 500
Oooops. We are down.
But don't worry, we will be back up shortly."
Thanks for your help.

Re: Open subtitles API download issue

Posted: Fri Feb 11, 2022 6:50 am
by oss
hi, that link is already expired. What is file_id ?

Re: Open subtitles API download issue

Posted: Fri Feb 11, 2022 12:05 pm
Thanks for your answer. I don't remember the file_id so I'll generate a couple of new ones.

This is file_id = 807627 https://www.opensubtitles.com/download/ ... 352806.srt

and this is file_id = 207708 https://www.opensubtitles.com/download/ ... 352806.srt

UPDATE

Turns out I was mixing up the subtitle id with the file id, but it still doesn't work:

file_id = 215080 gives me https://www.opensubtitles.com/download/ ... string.srt

and file_id = 5047678 gives me https://www.opensubtitles.com/download/ ... string.srt

UPDATE 2

Ok the links seem to work now, so it was my mistake. Sorry for wasting your time and thanks for your help.

Re: Open subtitles API download issue

Posted: Fri Feb 11, 2022 1:50 pm
by os_dev


UPDATE 2

Ok the links seem to work now, so it was my mistake. Sorry for wasting your time and thanks for your help.
oh don't worry about this, debugging is my life. Also, I could fix a little bug while tracking your downloads, so was a helpful post !

Re: Open subtitles API download issue

Posted: Fri Feb 11, 2022 2:48 pm
oh don't worry about this, debugging is my life. Also, I could fix a little bug while tracking your downloads, so was a helpful post !
Happy to "help" :D

Re: Open subtitles API download issue

Posted: Mon Sep 19, 2022 6:17 am
by usman_click
Re: Open subtitles API download issue

Helllo, i ran into the same issue


Java OkHttpClient Request

Code: Select all

OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\n \"file_id\": 7654844\n}"); Request request = new Request.Builder() .url("https://api.opensubtitles.com/api/v1/download") .post(body) .addHeader("Content-Type", "application/json") .addHeader("Api-Key", "API-KEY") .addHeader("Authorization", "Bearer <TOKEN>") .build();


Response

Code: Select all

Response{protocol=h2, code=406, message=, url=https://api.opensubtitles.com/api/v1/download}

Re: Open subtitles API download issue

Posted: Mon Sep 19, 2022 4:08 pm
by os_dev
Re: Open subtitles API download issue

Helllo, i ran into the same issue


Java OkHttpClient Request

Code: Select all

OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\n \"file_id\": 7654844\n}"); Request request = new Request.Builder() .url("https://api.opensubtitles.com/api/v1/download") .post(body) .addHeader("Content-Type", "application/json") .addHeader("Api-Key", "API-KEY") .addHeader("Authorization", "Bearer <TOKEN>") .build();


Response

Code: Select all

Response{protocol=h2, code=406, message=, url=https://api.opensubtitles.com/api/v1/download}

Please experiment with the API using a program such as Postman or Insomnia, then if a request is causing problem, you can copy it as CURL and post it here.

Re: Open subtitles API download issue

Posted: Wed Apr 12, 2023 5:43 pm
by qacomohibeb
Hi,

I'm having some issues with the new API:

Login goes just fine and I'm getting this reply (redacted):

Code: Select all

{'user': {'allowed_translations': 10, 'allowed_downloads': 1000, 'remaining_downloads': 1000, 'level': 'VIP Member', 'user_id': xxxxxx, 'ext_installed': False, 'vip': True}, 'token': 'ey...50', 'status': 200}
So: I have 1000 remaining downloads.
However, when attempting to download I'm immediately getting:

Code: Select all

{'requests': 7, 'remaining': -2, 'message': 'You have downloaded your allowed 5 subtitles for 24h.Your quota will be renewed in 17 hours and 46 minutes (2023-04-13 09:25:43 UTC) ', 'reset_time': '17 hours and 46 minutes', 'reset_time_utc': '2023-04-13T09:25:43.000Z'}
What's going on?

Re: Open subtitles API download issue

Posted: Wed Apr 12, 2023 11:36 pm
by oss
Hi
of course you read docs here
https://opensubtitles.stoplight.io/docs ... 8-download and of course you are passing also the first warning on that page, stating
"In HTTP request must be both headers: Api-Key and Authorization"

Are you 100% sure you are passing those parameters, because it seems Authorization is missing.