Giter Site home page Giter Site logo

Comments (4)

Siriusmart avatar Siriusmart commented on August 30, 2024

Um so when I do client.captions("VIDEO_ID", None), it returns something like this

Captions {
    captions: [Caption {
        label: "English (auto-generated)",
        language: "",
        url: "/api/v1/captions/FhhyqkbtaR4?label=English+%28auto-generated%29"
    }]
}

Which contains the url to the real captions file, I guess I'll just fix up some docs on how this works and bump up the crate.

from invidious-rs.

Siriusmart avatar Siriusmart commented on August 30, 2024

But do u think its a bit overkill to bump up the version without any real changes?

from invidious-rs.

rbozan avatar rbozan commented on August 30, 2024

If I was you I'd just bump up the patch version to 0.7.3 as you only changed the docs.

from invidious-rs.

Siriusmart avatar Siriusmart commented on August 30, 2024
    let client = get_invidious_client(); // The invidious client of this lib
    let result = client
        .fetch(&format!(
            "{}/api/v1/captions/{caption_id}?label={label}&languageCode={language}",
            client.instance
        ))
        .await?;

Given that client.captions() returns a url that looks like this /api/v1/captions/FhhyqkbtaR4?label=English+%28auto-generated%29, I have made some changes to the client.fetch() function.

  • That string can just be passed into client.fetch(), without needing to use format!("{instance}{url}")
  • The url can include leading slashed, or not
  • The original behaviour of client.fetch() is a duplicate of client.method.fetch(), so if you still want the original behaviour, it's still there. But since client is already specific to an instance, it would make sense to not ask for the instance address again

(note: that piece of code will break on 0.7.3)

from invidious-rs.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.