Archived
1
0
Fork
You've already forked osubs
0
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%
Find a file
2026年03月10日 16:04:13 -03:00
examples tests and docs 2026年03月10日 16:04:13 -03:00
lang docs 2026年03月09日 16:14:27 -03:00
order docs 2026年03月09日 16:14:27 -03:00
.gitignore base 2026年03月03日 12:07:11 -03:00
filter.go tests and docs 2026年03月10日 16:04:13 -03:00
filter_test.go docs 2026年03月09日 16:14:27 -03:00
go.mod code organization 2026年03月07日 13:33:35 -03:00
go.sum code organization 2026年03月07日 13:33:35 -03:00
LICENSE base 2026年03月03日 12:07:11 -03:00
README.md tests and docs 2026年03月10日 16:04:13 -03:00
request.go tests and docs 2026年03月10日 16:04:13 -03:00
request_test.go tests and docs 2026年03月10日 16:04:13 -03:00
response.go tests and docs 2026年03月10日 16:04:13 -03:00

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.org could 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

Donate

  • Bitcoin (QR) 1GqdJ63RDPE4eJKujHi166FAyigvHu5R7v
  • Paypal