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.
shleemypants
Posts: 10
Joined: Thu Sep 09, 2021 2:28 pm

Re: [OS] Brand new REST API for testing

Wed Dec 07, 2022 9:13 pm

Hi again!
Thanks for your earlier response. Please kindly look into this one:

In the following query, file_name of the first item doesn't have an extension:

Code: Select all

https://api.opensubtitles.com/api/v1/subtitles?episode_number=5&languages=en&moviehash=bdab37a50f89f8c6&season_number=2

Code: Select all

{ "id": "2097549", "type": "subtitle", "attributes": { "subtitle_id": "2097549", "language": "en", "download_count": 102423, "new_download_count": 299, "hearing_impaired": false, "hd": false, "fps": 23.98, "votes": 0, "ratings": 0.0, "from_trusted": false, "foreign_parts_only": false, "upload_date": "2008-04-08T02:47:43Z", "ai_translated": false, "machine_translated": false, "release": "How.I.Met.Your.Mother.S02.DVDRip.XviD-WAT", "comments": "", "legacy_subtitle_id": 4361866, "uploader": { "uploader_id": 44325, "name": "powerleakin", "rank": "Bronze Member" }, "feature_details": { "feature_id": 88174, "feature_type": "Episode", "year": 2006, "title": "World's Greatest Couple", "movie_name": "How I Met Your Mother - S02E05 World's Greatest Couple", "imdb_id": 866188, "tmdb_id": 62782, "season_number": 2, "episode_number": 5, "parent_imdb_id": 460649, "parent_title": "How I Met Your Mother", "parent_tmdb_id": 1100, "parent_feature_id": 7810 }, "url": "https://www.opensubtitles.com/en/subtitles/legacy/4361866", "related_links": [ { "label": "All subtitles for Tv Show How I Met Your Mother", "url": "https://www.opensubtitles.com/en/features/redirect/7810", "img_url": "https://s9.osdb.link/features/4/7/1/88174.jpg" }, { "label": "All subtitles for Episode World's Greatest Couple", "url": "https://www.opensubtitles.com/en/features/redirect/88174" } ], "files": [ { "file_id": 2179736, "cd_number": 1, "file_name": "How I Met your Mother - 205 - Worlds Greatest Couple" } ], "moviehash_match": true } }
But the download endpoint has the file_name with a proper extension (file id: 2179736).

Code: Select all

{ "link": "<REMOVED>/subfile/How%20I%20Met%20your%20Mother%20-%20205%20-%20Worlds%20Greatest%20Couple.srt", "file_name": "How I Met your Mother - 205 - Worlds Greatest Couple.srt", "requests": 2, "remaining": 3, "message": "Your quota will be renewed in 23 hours and 47 minutes (2022-12-08 18:50:43 UTC) ", "reset_time": "23 hours and 47 minutes", "reset_time_utc": "2022-12-08T18:50:43.000Z" }
To find the file extension, should I check both endpoints or just the download endpoint is fine?
Thanks in advance.

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

Re: [OS] Brand new REST API for testing

Thu Dec 15, 2022 1:32 pm

Hi again!
Thanks for your earlier response. Please kindly look into this one:

In the following query, file_name of the first item doesn't have an extension:

Code: Select all

https://api.opensubtitles.com/api/v1/subtitles?episode_number=5&languages=en&moviehash=bdab37a50f89f8c6&season_number=2

Code: Select all

{ "id": "2097549", "type": "subtitle", "attributes": { "subtitle_id": "2097549", "language": "en", "download_count": 102423, "new_download_count": 299, "hearing_impaired": false, "hd": false, "fps": 23.98, "votes": 0, "ratings": 0.0, "from_trusted": false, "foreign_parts_only": false, "upload_date": "2008-04-08T02:47:43Z", "ai_translated": false, "machine_translated": false, "release": "How.I.Met.Your.Mother.S02.DVDRip.XviD-WAT", "comments": "", "legacy_subtitle_id": 4361866, "uploader": { "uploader_id": 44325, "name": "powerleakin", "rank": "Bronze Member" }, "feature_details": { "feature_id": 88174, "feature_type": "Episode", "year": 2006, "title": "World's Greatest Couple", "movie_name": "How I Met Your Mother - S02E05 World's Greatest Couple", "imdb_id": 866188, "tmdb_id": 62782, "season_number": 2, "episode_number": 5, "parent_imdb_id": 460649, "parent_title": "How I Met Your Mother", "parent_tmdb_id": 1100, "parent_feature_id": 7810 }, "url": "https://www.opensubtitles.com/en/subtitles/legacy/4361866", "related_links": [ { "label": "All subtitles for Tv Show How I Met Your Mother", "url": "https://www.opensubtitles.com/en/features/redirect/7810", "img_url": "https://s9.osdb.link/features/4/7/1/88174.jpg" }, { "label": "All subtitles for Episode World's Greatest Couple", "url": "https://www.opensubtitles.com/en/features/redirect/88174" } ], "files": [ { "file_id": 2179736, "cd_number": 1, "file_name": "How I Met your Mother - 205 - Worlds Greatest Couple" } ], "moviehash_match": true } }
But the download endpoint has the file_name with a proper extension (file id: 2179736).

Code: Select all

{ "link": "<REMOVED>/subfile/How%20I%20Met%20your%20Mother%20-%20205%20-%20Worlds%20Greatest%20Couple.srt", "file_name": "How I Met your Mother - 205 - Worlds Greatest Couple.srt", "requests": 2, "remaining": 3, "message": "Your quota will be renewed in 23 hours and 47 minutes (2022-12-08 18:50:43 UTC) ", "reset_time": "23 hours and 47 minutes", "reset_time_utc": "2022-12-08T18:50:43.000Z" }
To find the file extension, should I check both endpoints or just the download endpoint is fine?
Thanks in advance.

Hi,

sorry for the late response.

the format is not really relevant. in the /subtitles endpoint, it's indicated without extension, because they can be generated with any extension.

in the /download endpoint, you see the file with the ".srt" extension because it is the default. you can make a request with another file_name, or with a different format, if you just send the file_id, the file name will be the default file name with srt format.

hope that makes sense

os_dev

shleemypants
Posts: 10
Joined: Thu Sep 09, 2021 2:28 pm

Re: [OS] Brand new REST API for testing

Thu Dec 15, 2022 1:49 pm


Hi,

sorry for the late response.

the format is not really relevant. in the /subtitles endpoint, it's indicated without extension, because they can be generated with any extension.

in the /download endpoint, you see the file with the ".srt" extension because it is the default. you can make a request with another file_name, or with a different format, if you just send the file_id, the file name will be the default file name with srt format.

hope that makes sense

os_dev
Hi,

No worries.

That's great! I see how it works now.

Thank you very much for taking the time to answer, I really appreciate it.

shleemypants
Posts: 10
Joined: Thu Sep 09, 2021 2:28 pm

Re: [OS] Brand new REST API for testing

Sat Sep 30, 2023 1:18 am

Hi, I've noticed when the user agent is not set, you're returning the error message as html instead of json.
Please consider returning the error message in json format.

Return to “Developing”

Who is online

Users browsing this forum: No registered users and 25 guests