Forum rules
Under no circumstances is spamming or advertising of any kind allowed. Do not post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate others security. Profanity or any kind of insolent behavior to other members (regardless of rank) will not be tolerated. Remember, what you don’t find offensive can be offensive to other members. Please treat each other with the kind of reverence you’d expect from other members.
Failure to comply with any of the above will result in users being banned without notice. If any further details are needed, contact: “The team” using the link at the bottom of the forum page. Thank you.
Yasue
Posts: 3
Joined: Fri Aug 18, 2023 6:42 am

503 - Service unavailable when downloading subtitles

Fri Aug 18, 2023 6:58 am

Hello, i am new to this service and forum.

I am a developer and currently working on a passional project related to movies that i have stored in my HDD. I payed VIP subscription and worked on a script to automatically download subtitles for each of my movie files. The login part works fine and i am able to find the subtitles that i want. I get the Id and use the following URL to download it:

https://api.opensubtitles.com/api/v1/download

Here is an example of my request (i am using nodejs and fetch):

Code: Select all

{ method: 'post', headers: { 'Content-Type': 'application/json', Accept: 'application/json', Authorization: 'Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }, body: '{"file_id":146944}' }
And the response that i get is:

Code: Select all

{ data: { message: 'Service unavailable' } }
The code of the response is 503, so i doubt this is related to permission's issues. I have tried with several Ids, ill give you a list of Ids that i have tried:
4366289, 146944, 333212, 333212

I appreciate very much your response. Let me know if you need to know more about the problem.
Thank you!

User avatar
oss
Site Admin
Posts: 5890
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: 503 - Service unavailable when downloading subtitles

Sat Aug 19, 2023 3:35 am

Hi

it is working for you now ? If not, please send us CURL example, same as we request in documentation: https://opensubtitles.stoplight.io/docs ... questions-

it works here:

Code: Select all

curl --request POST \ --url https://api.opensubtitles.com/api/v1/download \ --header 'Api-Key: <KEY>' \ --header 'Authorization: Bearer <TOKEN> \ --header 'Content-Type: application/json' \ --data '{ "file_id":4366289 }'
result

Code: Select all

{ "link": "https://www.opensubtitles.com/download/E632873B966A73D15D9186B11A0076741B8A627D54C3A697568BDC49594341229C18CE3EBF83ED15BAEB9AC0992FE706CE4F28EA2BB56F96C3A6B7CD25A2A2C590469EBD15015F90D43C1B82670C5D2E5EE674F43E48CDB0B2168CA50E3B08BF5B10E5C0C740F1BEBD343A4716E5A96162288B6583D6B41DD7E947E319BDB5F77042D908E3ED3FED4E56CFC4CB928DE31C72820CC78E8258CB19C7297BCB6162C49DE9C34D0FAD0B19E351FD45AEA51FF1B01C0ACBB045B1B530418D4558F8FC927304D8BC8E2D33E355EEDF080B12ED838BE39F35DFF341F869AE96EDB976F6E62C2B8EEB96ABDEA455207D02945870172FA7EA22C64A6647C3F43B2667F625C3A616AF87486898855BE0822A87084335F7F58540CABD5DAF2A9C1B774D5D0C460DADE63A6F6622/subfile/good.behavior.s02e06.sub.ita.subsfactory.srt", "file_name": "good.behavior.s02e06.sub.ita.subsfactory.srt", "requests": 1, "remaining": 49, "message": "Your quota will be renewed in 22 hours and 27 minutes (2023-08-19 23:59:59 UTC) ts=1692408774 ", "reset_time": "22 hours and 27 minutes", "reset_time_utc": "2023-08-19T23:59:59.999Z", "uk": "...", "uid": ..., "ts": 1692408774 }

Yasue
Posts: 3
Joined: Fri Aug 18, 2023 6:42 am

Re: 503 - Service unavailable when downloading subtitles

Sat Aug 19, 2023 11:52 pm

Hello oss, thanks for your response.

This is my cURL request:

Code: Select all

curl --request POST --url https://api.opensubtitles.com/api/v1/download --header 'Accept: application/json' --header 'Authorization: Bearer [TOKEN]' --header 'Content-Type: application/json' --data '{ "file_id": 5143312 }'
And the response is the same:

Code: Select all

{"message":"Service unavailable"}
I noticed that the documentation also provides an example using fetch/nodejs:
const url = 'https://api.opensubtitles.com/api/v1/download';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: 'Bearer undefined'
},
body: '{"file_id":123}'
};

try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}

It is exactly the same (basically) of what i have in my code... However i always receive the same message: "Service unavailable"

User avatar
oss
Site Admin
Posts: 5890
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: 503 - Service unavailable when downloading subtitles

Sun Aug 20, 2023 7:56 am

Hi

you are missing there "api-key" header, you MUST to provide it everywhere.

Yasue
Posts: 3
Joined: Fri Aug 18, 2023 6:42 am

Re: 503 - Service unavailable when downloading subtitles

Mon Aug 21, 2023 12:31 am

Hello,

Wow it appears to have worked now... Thank you very much, i suggest the documentation should be updated to reflect this, because that section does not include the Api Key in the headers:
https://opensubtitles.stoplight.io/docs ... 8-download

Also updating the error message would be very helpful :)

Thanks a bunch!

os_dev
Posts: 194
Joined: Wed Oct 17, 2018 3:42 pm

Re: 503 - Service unavailable when downloading subtitles

Mon Aug 21, 2023 11:28 am

Hello,

Wow it appears to have worked now... Thank you very much, i suggest the documentation should be updated to reflect this, because that section does not include the Api Key in the headers:
https://opensubtitles.stoplight.io/docs ... 8-download

Also updating the error message would be very helpful :)

Thanks a bunch!
Hi,
so it seems you just had a random 503 when you tested, when the api key is missing, you should get a "401 - missing api key" error. Sorry about the 503 these are by definition the errors we couldn't catch, we do our best to avoid them but they can still occur, so the best is to have systems that will try again a request if it fails

for the docs, it's the first big warning on download docs

it is also indicated in the best practices


cheers
os_dev

Screenshot 2023-08-21 at 11.21.02.jpg
Screenshot 2023-08-21 at 11.21.02.jpg (115.65 KiB) Viewed 4360 times
Attachments
Screenshot 2023-08-21 at 11.24.00.jpg
Screenshot 2023-08-21 at 11.24.00.jpg (25.65 KiB) Viewed 4360 times

Return to “Developing”

Who is online

Users browsing this forum: No registered users and 20 guests