Sat Nov 04, 2023 8:19 am
Thank you for your reply.
I am sorry. There was a lack of explanation, and I was able to find out the cause.
The issue isn't with the API(api.opensubtitles.com) itself, but with downloading files from the URL it provides.
However, when I removed the Api-Key, Authorization, and X-User-Agent headers from the request, I was able to download it. This is because by using only commonly used headers, the browser (Chrome) sends the GET request directly instead of checking with an OPTIONS request.
The reason I couldn't download the file was because I added X-User-Agent etc. when downloading the file.
When an OPTIONS request occurs, it seems that an error occurs because the response from www.opensubtitles.com is missing necessary headers. (I was able to see it when I opened it directly in the browser, but for some reason a 404 was returned when I sent the OPTIONS request.)
curl -v -X OPTIONS \
--url 'https://www.opensubtitles.com/download/E1848123179276226103BD9C1E9E2FE7B0B9AD65AAF2D8637FE61085EDCA0ACC5FCCD22E3D9C9EAF242D2BE8CD72A1F1AA6FCF47B7C51C8B42B646CD071F9CF6AD96496296625538DF1332AA18500E36429D5C880DF0661970A43E129545BF25CA123EAF6EF064907A518DE2F13457D4264022761DF799D7E71AAFDF18B470F1DEBF929395EFEE27438DD0C7040FF068CAA94CD40159D30011E511DB39963B11CC0A880E8BB2B27CADE00C917E722304DB2C613362DEE419C6F48C2DEDFA8EDFCE1B7CD7CCDE3BEFD9CB808970991089F14A21A868824B42A40AB85488693409988F1B7E249B171142BBAE900315A1E2F2A9D41CD2B8C86B9804FF3DA863ECC18F838D74286D41F600C1A4A02F0ACE6F7BDE4A844C29A220BB66BA7031F3B18436E528159932E690E4AC99E5140669F9/subfile/%5BCrunchyroll%5D%20SPY%20x%20FAMILY%20S01E02%20SECURE%20A%20WIFE.eng.srt' \
-H 'Access-Control-Request-Method: GET' \
-H 'Access-Control-Request-Headers: x-user-agent' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36'