1
0
Fork
You've already forked opensubs
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.
  • Rust 100%
Find a file
2026年03月10日 19:55:13 -03:00
examples docs 2025年06月29日 12:35:32 -03:00
src upgrade libs 2026年03月10日 19:55:13 -03:00
.gitignore first approach 2025年06月22日 16:59:26 -03:00
Cargo.toml upgrade libs 2026年03月10日 19:55:13 -03:00
LICENSE Initial commit 2025年06月01日 18:59:56 -03:00
README.md upgrade libs 2026年03月10日 19:55:13 -03:00

opensubs

Library to search subtitles from opensubtitles.org

Description

This crate provides a high-level, ergonomic API for searching and retrieving subtitles (only from movies) and related metadata from opensubtitles.org. It offers both asynchronous and blocking (synchronous) interfaces, with flexible filtering and ordering options. It uses a web scraper to build the api

Usage

Add this crate to your Cargo.toml:

[dependencies]
opensubs = "0.1.0"

Enable blocking feature if needed

[dependencies]
opensubs = { version = "0.1.0", features = ["blocking"] }

Async Example (default)

useopensubs::{Filters,Language,OrderBy,SearchBy};#[tokio::main]asyncfn main()-> opensubs::Result{// async search movie "holdovers", spanish subs, order by rating
letresults=opensubs::search(SearchBy::MovieAndFilter("holdovers",Filters::default().languages(&[Language::Spanish]).order_by(OrderBy::Rating).build(),)).await?;println!("Subtitles {results:#?}");Ok(())}

Blocking Example (feature "blocking")

useopensubs::{Filters,Language,OrderBy,Response,SearchBy};fn main()-> opensubs::Result{// blocking search movie "the godfather"
// year 1972, french and german subs, order by rating
letresults=opensubs::blocking::search(SearchBy::MovieAndFilter("the godfather",Filters::default().year(1972).languages(&[Language::French,Language::German]).order_by(OrderBy::Downloads).build(),))?;matchresults{Response::Movie(movies)=>{// If results is Movie type, get the subtitles_link property 
// and find subtitles for it
ifletSome(movie)=movies.first(){letsubs=opensubs::blocking::search(SearchBy::Url(&movie.subtitles_link))?;println!("Subtitles {subs:#?}");}}// else print the subtitles
_=>println!("Subtitles {results:#?}"),}Ok(())}

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 the Response is an enum.
  • Here are more examples

Features

  • Default async search. Blocking search available too
  • Search by url, movie name and/or filters (languages, page, ordering and year)
  • Obtain not only info and metadata but also a subtitle download link. Here is an example of download using wget

Docs

Find all the configuration options in the full documentation.


Donate

  • Bitcoin (QR) 1GqdJ63RDPE4eJKujHi166FAyigvHu5R7v
  • Paypal