get-subtitles returns a zip archive with subtitles for a movie usage curl -G --fail-with-body -O -J --data-urlencode "movie=Scary.Movie.2000.720p.mp4" http://erebus.feralhosting.com:9591/bin/get-subtitles && unzip Scary.Movie.2000.720p.subs.zip curl -G --fail-with-body -o - --data-urlencode "movie=Scary.Movie.2000.720p.mp4" http://erebus.feralhosting.com:9591/bin/get-subtitles | bsdtar -xvf - source https://github.com/milahu/opensubtitles-scraper/raw/main/get-subs.py client #!/usr/bin/env bash # get-subs.sh - get subtitles from subtitles server server_url="http://erebus.feralhosting.com:9591/bin/get-subtitles" curl=(curl) command -v curl >/dev/null || { echo "error: curl was not found"; exit 1; } command -v unzip >/dev/null || { echo "error: unzip was not found"; exit 1; } [ -n "$1" ] || { echo "usage: $0 path/to/Scary.Movie.2000.720p.mp4"; exit 1; } while (( $# > 0 )); do dir="$(dirname "$1")" [ -e "$dir" ] || { echo "error: no such directory: ${dir@Q}"; exit 1; } pushd "$dir" >/dev/null movie="$(basename "$1")" if command -v bsdtar >/dev/null; then # https://superuser.com/a/1834410/951886 # write error body to stderr "${curl[@]}" -G --fail-with-body -D - -o - --data-urlencode "movie=$movie" "$server_url" | { s=; while read -r h; do h="${h:0: -1}"; if [ -z "$s" ]; then s=${h#* }; s=${s%% *}; fi; [ -z "$h" ] && break; done if [ "${s:0:1}" = 2 ]; then cat; else cat >&2; fi } | bsdtar -xvf - else zip="${movie%.*}.subs.zip" ! [ -e "$zip" ] || { echo "error: tempfile exists: ${zip@Q}"; exit 1; } if ! "${curl[@]}" -G --fail-with-body -o "$zip" --data-urlencode "movie=$movie" "$server_url"; then cat "$zip" && rm "$zip" # zip contains the error message else unzip "$zip" && rm "$zip" fi fi popd >/dev/null shift done filenames when you pass a movie filename like movie=Scary.Movie.2000.720p.mp4 then the subtitle files will be named Scary.Movie.2000.720p.12345.srt etc so when you extract them to the folder of the movie file then your video player should find the subtitles language you can pass one or more languages as 2 letter codes per ISO 639-1 or as 3 letter codes per ISO 639-2 https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes the output filenames have the format "Some.Movie.2000.{num}.{lang}.srt" where lang is a 3 letter code compatible with video players ?movie=Futurama.S06E07.The.Late.Philip.J.Fry.mp4&lang=es ?movie=Futurama.S06E07.The.Late.Philip.J.Fry.mp4&lang=en,es,fr,de,cz,cn ?movie=Futurama.S06E07.The.Late.Philip.J.Fry.mp4&lang=eng,spa,fre,ger,cze,chi encoding the subtitles are not recoded to utf8 because im too lazy to finish this postprocessing most subtitles should have utf8 encoding but some subtitles can have single-byte encodings like latin1 see also https://github.com/milahu/opensubtitles-scraper/raw/main/repack.py adblocker this is not done on the server side to save cpu time to remove ads, see https://github.com/milahu/opensubtitles-scraper/raw/main/opensubtitles_adblocker.py to add more ads to the blocklist, see https://github.com/milahu/opensubtitles-scraper/raw/main/opensubtitles_adblocker_add.py