打开字幕的 REST API POST /api/v1/download
Open Subtitle's REST API POST /api/v1/download
我阅读了 Opensubtitle 的新 API here 文档,在尝试访问下载端点时收到 500 错误。我在其他端点上取得了成功,包括 /api/v1/login 和 /api/v1/subtitles.
这是我尝试请求的 JSON 格式的数据
{'id': '5164746',
'type': 'subtitle',
'attributes': {'subtitle_id': '5164746',
'language': 'en',
'download_count': 9608,
'new_download_count': 46,
'hearing_impaired': False,
'hd': True,
'format': None,
'fps': 23.976,
'votes': 0,
'points': 0,
'ratings': 0.0,
'from_trusted': False,
'foreign_parts_only': False,
'auto_translation': False,
'ai_translated': False,
'machine_translated': None,
'upload_date': '2020-02-09T13:59:42Z',
'release': '2160p.4K.BluRay.x265.10bit.AAC5.1-[YTS.MX]',
'comments': "Slightly resynced the 1080p.WEBRip.x264-[YTS.LT] version by explosiveskull to this 4K release. HI removed. I didn't do 4K sync for Infinity War, as they're already on site here:\r\nHi: https://www.opensubtitles.org/en/subtitles/7436082/avengers-infinity-war-en\r\nNo HI: https://www.opensubtitles.org/en/subtitles/7436058/avengers-infinity-war-en",
'legacy_subtitle_id': 8092829,
'uploader': {'uploader_id': 66694,
'name': 'pooond',
'rank': 'bronze member'},
'feature_details': {'feature_id': 626618,
'feature_type': 'Movie',
'year': 2019,
'title': 'Avengers: Endgame',
'movie_name': '2019 - Avengers: Endgame',
'imdb_id': 4154796,
'tmdb_id': 299534},
'url': 'https://www.opensubtitles.com/en/subtitles/legacy/8092829',
'related_links': {'label': 'All subtitles for Avengers: Endgame',
'url': 'https://www.opensubtitles.com/en/movies/2019-untitled-avengers-movie',
'img_url': 'https://s9.osdb.link/features/8/1/6/626618.jpg'},
'files': [{'file_id': 5274788,
'cd_number': 1,
'file_name': 'Avengers.Endgame.2019.2160p.4K.BluRay.x265.10bit.AAC5.1-[YTS.MX].srt'}]}}
这是我要发送的请求:
headers = {
'Api-Key': api_one,
'Authorization': auth,
'Content-Type': 'application/json',
}
data = '{"file_id":5274788,"sub_format":"srt","file_name":"Avengers.Endgame.2019.2160p.4K.BluRay.x265.10bit.AAC5.1-[YTS.MX]","strip_html":true,"cleanup_links":true,"remove_adds":true,"in_fps":0,"out_fps":0,"timeshift":0}'
response = requests.post('https://www.opensubtitles.com/api/v1/download', headers=headers, data=data)
有没有其他人成功使用来自此 API 的下载端点?
啊,好的,我找到了解决方案。看起来有些参数有错误。这是 documentation 的 link。更新了 post 请求的数据参数以仅包含 file_id.
data = '{"file_id":5274788}'
响应 = requests.post('https://www.opensubtitles.com/api/v1/download', headers=headers, data=data)
我阅读了 Opensubtitle 的新 API here 文档,在尝试访问下载端点时收到 500 错误。我在其他端点上取得了成功,包括 /api/v1/login 和 /api/v1/subtitles.
这是我尝试请求的 JSON 格式的数据
{'id': '5164746',
'type': 'subtitle',
'attributes': {'subtitle_id': '5164746',
'language': 'en',
'download_count': 9608,
'new_download_count': 46,
'hearing_impaired': False,
'hd': True,
'format': None,
'fps': 23.976,
'votes': 0,
'points': 0,
'ratings': 0.0,
'from_trusted': False,
'foreign_parts_only': False,
'auto_translation': False,
'ai_translated': False,
'machine_translated': None,
'upload_date': '2020-02-09T13:59:42Z',
'release': '2160p.4K.BluRay.x265.10bit.AAC5.1-[YTS.MX]',
'comments': "Slightly resynced the 1080p.WEBRip.x264-[YTS.LT] version by explosiveskull to this 4K release. HI removed. I didn't do 4K sync for Infinity War, as they're already on site here:\r\nHi: https://www.opensubtitles.org/en/subtitles/7436082/avengers-infinity-war-en\r\nNo HI: https://www.opensubtitles.org/en/subtitles/7436058/avengers-infinity-war-en",
'legacy_subtitle_id': 8092829,
'uploader': {'uploader_id': 66694,
'name': 'pooond',
'rank': 'bronze member'},
'feature_details': {'feature_id': 626618,
'feature_type': 'Movie',
'year': 2019,
'title': 'Avengers: Endgame',
'movie_name': '2019 - Avengers: Endgame',
'imdb_id': 4154796,
'tmdb_id': 299534},
'url': 'https://www.opensubtitles.com/en/subtitles/legacy/8092829',
'related_links': {'label': 'All subtitles for Avengers: Endgame',
'url': 'https://www.opensubtitles.com/en/movies/2019-untitled-avengers-movie',
'img_url': 'https://s9.osdb.link/features/8/1/6/626618.jpg'},
'files': [{'file_id': 5274788,
'cd_number': 1,
'file_name': 'Avengers.Endgame.2019.2160p.4K.BluRay.x265.10bit.AAC5.1-[YTS.MX].srt'}]}}
这是我要发送的请求:
headers = {
'Api-Key': api_one,
'Authorization': auth,
'Content-Type': 'application/json',
}
data = '{"file_id":5274788,"sub_format":"srt","file_name":"Avengers.Endgame.2019.2160p.4K.BluRay.x265.10bit.AAC5.1-[YTS.MX]","strip_html":true,"cleanup_links":true,"remove_adds":true,"in_fps":0,"out_fps":0,"timeshift":0}'
response = requests.post('https://www.opensubtitles.com/api/v1/download', headers=headers, data=data)
有没有其他人成功使用来自此 API 的下载端点?
啊,好的,我找到了解决方案。看起来有些参数有错误。这是 documentation 的 link。更新了 post 请求的数据参数以仅包含 file_id.
data = '{"file_id":5274788}'
响应 = requests.post('https://www.opensubtitles.com/api/v1/download', headers=headers, data=data)