Library to search subtitles from opensubtitles.org
This repository has been archived on 2026年06月27日 . You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
- Go 100%
| examples | tests and docs | |
| lang | docs | |
| order | docs | |
| .gitignore | base | |
| filter.go | tests and docs | |
| filter_test.go | docs | |
| go.mod | code organization | |
| go.sum | code organization | |
| LICENSE | base | |
| README.md | tests and docs | |
| request.go | tests and docs | |
| request_test.go | tests and docs | |
| response.go | tests and docs | |
osubs
Library to search subtitles from opensubtitles.org
Caveats
- This library requires Go 1.26
- This library provides a high-level, ergonomic API for searching and retrieving subtitles (only from movies) and related metadata from
opensubtitles.org.
Insstallation
go get -u github.com/javiorfo/osubs@latest
Example
packagemainimport("log""github.com/javiorfo/osubs""github.com/javiorfo/osubs/lang""github.com/javiorfo/osubs/order")funcmain(){resp,err:=osubs.Search("godfather",osubs.Language(lang.Spanish,lang.SpanishLA),osubs.Year(1972))iferr!=nil{log.Fatal(err)}processResponse(resp)resp,err=osubs.Search("pulp fiction",osubs.Language(lang.French,lang.German))iferr!=nil{log.Fatal(err)}processResponse(resp)resp,err=osubs.Search("terminator",osubs.Order(order.Downloads))iferr!=nil{log.Fatal(err)}processResponse(resp)}funcprocessResponse(rosubs.Response){switchs:=r.(type){caseosubs.Result[osubs.Subtitle]:forsub:=ranges.Items{log.Printf("%+v\n",sub)}caseosubs.Result[osubs.Movie]:formovie:=ranges.Items{log.Printf("%+v\n",movie)}s.Items.First().Consume(func(mosubs.Movie){resp,err:=m.SearchSubtitles()iferr!=nil{log.Fatal(err)}processResponse(resp)})default:log.Println("no results")}}Details
- Searching subtitles from
opensubtitles.orgcould return a list of movies or a list of subtitles of the movie searched (if the text and filter are more exactly). For that matter Response is a sealed interface