A asynchronous implementation of the invidious innertube aka youtubei API wrapper

Overview

youtubei-rs

A asynchronous implementation of the invidious innertube aka youtubei API wrapper.
Using tokio,reqwest, serde and serde_json.

Configuration

The client_config can be configured to dump the json response to a file if its not parsable,
this is on by default when using the default_client_config() function.
When creating the client_config manually you can parse true/false as the last parameter to disable this behavior.

Roadmap

  • implementing proxy support
  • removing panics
  • adding more endpoints

Implemented endpoints

  • next
  • browse
  • search
  • resolve_url
  • player

Supported queries

  • next_video_id // Get next(aka related and comments) results for a given videoId
  • next_continuation // Fetch more next(aka related and comments) results for a given ctoken
  • browse_id // Get browse(aka a channel or playlist) results for a given browseId
  • browse_continuation // Fetch more browse(aka a channel or playlist) results for a given ctoken
  • resolve, // Resolve a given url
  • player // Get player data for a given videoId

Example

use youtubei_rs::{query::player, utils::default_client_config, types::query_results::PlayerResult};
#[tokio::main]
async fn main() {
    // create default client_config with WEB client
    let client_config = &default_client_config();
    // get player for video with id gC6dQrScmHE
    let player: PlayerResult = player(String::from("gC6dQrScmHE"),String::from(""),&client_config).await.unwrap();
    println!("{}",player.video_details.title); // video title
}

With logging

For logging tracing is used so tracing_subscribe can be installed for easier use of tracing. The library has as target youtubei_rs with debug,trace and error levels.

use youtubei_rs::{query::player, utils::default_client_config};
#[tokio::main]
async fn main() {
    std::env::set_var("RUST_LOG", "youtubei_rs=debug");
    tracing_subscriber::fmt::init();
    // create default client_config with WEB client
    let client_config = &default_client_config();
    // get player for video with id gC6dQrScmHE
    let player: PlayerResult = player(String::from("gC6dQrScmHE"),String::from(""),&client_config).await.unwrap();
    println!("{}",player.video_details.title); // video title
}

Supported queries (legacy)

  • get_video: Fetches all information about the video except captions and storyboards
  • get_channel_info: Fetches all channel information and about tab
  • get_channel_tab: Fetches a specific tab like videos to get channel videos
  • search: Search youtube
  • load_search: Continue search with ctoken
  • get_comments: Loads initial comments or more comments for video
  • load_related_videos: Loads more related videos
  • get_playlist: Loads a playlist

For more in depth info take a look at query.rs and tests.rs

Comments
  • [Trivial] Some code style changes

    [Trivial] Some code style changes

    This PR mostly just changes some trivial code formatting. I hope it would be useful. A lot of it is subjective, but at times I just felt it looked better. I'm not trying to impose my own preference on you, so you are free to make any necessary changes.

    It also does the following:

    • Adds clippy and rustfmt to the pipeline. I'm not sure if the pipeline has the a write permission or if I've done it correctly, so it might need to be replaced with the proper action.
    • Formats the code with rustfmt and applies some clippy suggestions. I've also added some line breaks to make it look less dense. I hope they make sense and separate different things correctly.
    • Fixes some Markdown formatting.
    opened by walking-octopus 5
  • [Trivial] Logic optimisation + Typo/style corrections

    [Trivial] Logic optimisation + Typo/style corrections

    • Shortens the extract_author logic, also removing a mutable in favour of an inline conditional.
    • Fixes a few styling issues (lack of whitespace).
    • Typo corrections.

    Compiled and tested! - cargo check && cargo test :heavy_check_mark:

    opened by JSKitty 2
  • Add support for includingResultsForRenderer

    Add support for includingResultsForRenderer

    includingResultsForRenderer found in search results when e.g searched via a hashtag, it shows what result are also included meaning result containing a different wording/writing

    bug 
    opened by 11Tuvork28 0
  • Added json dump on error

    Added json dump on error

    This dumps the json response in the pwd directory the naming convention is json_dump_endpoint+ requested endpoint name e.g browse. This feature needs to be impoved in regards the names because it gets overwritten which is bad. The content of the file include request params, the error itself and the json data.

    opened by 11Tuvork28 0
  • Fixed unknown type recognitionShelfRenderer fixes #4

    Fixed unknown type recognitionShelfRenderer fixes #4

    Adds RecognitionShelfRenderer to the ItemSectionRendererContents enum but its not getting parsed since its not needed but should probably be parsed in a future release

    opened by 11Tuvork28 0
  • [Trivial] A bunch of minor typo/style corrections

    [Trivial] A bunch of minor typo/style corrections

    Just a small PR for a Rust-y fren!

    • Fixes many small typos.
    • Fixes a few styling inconsistencies.
    • Shortens some conditional logic.

    Not tested / compiled, need to setup my Rust environment!

    opened by JSKitty 0
  • Support feed fetching

    Support feed fetching

    YouTube.js supports fetching recommendations, subscriptions, and trending videos. Does such a feature fit within this project's scope? Would this project also support OAuth in the future?

    I just wanted to create an issue for tracking progress for this feature.

    question 
    opened by walking-octopus 1
  • Implement a parser simular youtubei.js

    Implement a parser simular youtubei.js

    Currently, this project uses error-prone and difficult to maintain manual parsing for each response type. Implementing a YouTube.js-inspired parser would help to get rid of unnecessary unwraps, add a layer of abstraction for creating new API endpoints, and make the project more maintainable. Maybe a macro could be made for parsing the InnerTube responses.

    enhancement 
    opened by walking-octopus 7
  • Implement parsing for all other known clients

    Implement parsing for all other known clients

    Currently only the WEB is useable, since nothing else can be parse but that must change and the parsing api needs to be updated as well regarding the result columns since those should be in an enum for a more generic matching ability

    enhancement 
    opened by 11Tuvork28 0
Releases(1.3.5)
  • 1.3.5(Jul 5, 2022)

    What's Changed

    • Fixed unknown type recognitionShelfRenderer fixes #4 in https://github.com/11Tuvork28/youtubei-rs/pull/6
    • Added utility functions for checking various things

    Full Changelog: https://github.com/11Tuvork28/youtubei-rs/compare/1.3.4...1.3.5

    Source code(tar.gz)
    Source code(zip)
  • 1.3.4(Jun 13, 2022)

  • 1.2.4(Jun 9, 2022)

    What's Changed

    • Fixed parsing error when captions are not available
    • Removed one origin of possible panics
    • Fixed error when search endpoint returns searchPyvRenderer in json
    Source code(tar.gz)
    Source code(zip)
  • 1.2.3(Jun 9, 2022)

    What's Changed

    • Fixed examples
    • various bug fixes
    • Added filters to filter result
    • [Trivial] A bunch of minor typo/style corrections by @JSKitty in https://github.com/11Tuvork28/youtubei-rs/pull/1
    • [Trivial] Tiny condition shortening by @JSKitty in https://github.com/11Tuvork28/youtubei-rs/pull/2
    • [Trivial] Logic optimisation + Typo/style corrections by @JSKitty in https://github.com/11Tuvork28/youtubei-rs/pull/3

    New Contributors

    • @JSKitty made their first contribution in https://github.com/11Tuvork28/youtubei-rs/pull/1
    Source code(tar.gz)
    Source code(zip)
Owner
11Tuvork28
Hey there, I like to program.
11Tuvork28
List public items (public API) of Rust library crates. Enables diffing public API between releases.

cargo wrapper for this library You probably want the cargo wrapper to this library. See https://github.com/Enselic/cargo-public-items. public_items Li

Martin Nordholts 19 Aug 18, 2022
The second Rust implementation on GitHub of third-party REST API client for Bilibili.

Bilibili REST API The second Rust implementation on GitHub of third-party REST API client for Bilibili. Designed to be lightweight and efficient. It's

null 4 Aug 25, 2022
Rust wrapper for `os-release`

os-release-rs Rust wrapper for /etc/os-release file. Installation Add this to your Cargo.toml: [dependencies] os-release-rs = "0.1.0" Usage use os_rel

0xMRTT 3 Aug 10, 2022
Rust library for hardware accelerated drawing of 2D shapes, images, and text, with an easy to use API.

Speedy2D Hardware-accelerated drawing of shapes, images, and text, with an easy to use API. Speedy2D aims to be: The simplest Rust API for creating a

null 205 Sep 23, 2022
Code to follow along the "Zero To Production" book on API development in Rust.

Zero To Production / Code (Chapter 10 - Part 1) Zero To Production In Rust is an opinionated introduction to backend development using Rust. This repo

Luca Palmieri 2.4k Sep 25, 2022
Interact with the crate's API

cargo-crate-api Interact with the crate's API Documentation Installation Getting Started Reference FAQ Contribute CHANGELOG Install Download a pre-bui

null 7 Aug 9, 2022
Conversion Tools API Rust client

ConversionTools Rust This Conversion Tools API Rust client allows you to use the site API and convert files faster and more conveniently. Site Convers

WinsomeQuill 2 Jan 23, 2022
Public aircraft & flightroute api Built in Rust for Docker, using PostgreSQL & Redis

api.adsbdb.com public aircraft & flightroute api Built in Rust for Docker, using PostgreSQL & Redis See typescript branch for original typescript vers

Jack Wills 58 Sep 4, 2022
Simple RESTful API in rust created with actix-web. (Routing, models, JWT auth).

rust-simple-api Simple RESTful API created with rust, actix-web, Diesel, JWT. Running application Manual Firstly generate a secret.key which will be u

null 2 Jul 30, 2022
Simple Rust šŸ¦€ api with Rocket šŸš€

Car API Written in Rust & Rocket.rs ?? ?? Running project Running by cargo You just need to run the following command: cargo run Running on docker Fi

Bartosz Molka 2 Sep 2, 2022
Experimental Quantum Computer Simulator + Quantum Chess Implementation

Quantum Chess A somewhat hacky implementation of this paper (made in a week over a holiday). It's not heavily tested and probably has some bugs still

null 19 Jan 21, 2022
Ray Tracing: The Next Week implementation in Rust

rttnw Ray Tracing: The Next Week implementation in Rust How to run Install Rust: Link here. Run project git clone https://github.com/luliic2/rttnw cd

null 20 Apr 26, 2022
Rust implementation of ĀµKanren, a featherweight relational programming language.

ĀµKanren-rs This is a Rust implementation of ĀµKanren, a featherweight relational programming language. See the original Scheme implementation here for

Eric Zhang 98 Sep 1, 2022
ESP32 implementation of RustZX Spectrum emulator for ESP32-USB-OTG

RustZX for ESP32 - experimental version Goal of the project: Run ZX Spectrum on ESP32 HW: ESP32 OTG USB with ST7789 display References Rust code for E

Juraj MichƔlek 21 Aug 31, 2022
An implementation of Olm and Megolm in pure Rust.

A Rust implementation of Olm and Megolm vodozemac is a Rust implementation of libolm, a cryptographic library used for end-to-end encryption in Matrix

matrix.org 56 Sep 24, 2022
Pure Rust Implementation of secp256k1.

SECP256K1 implementation in pure Rust Cargo Documentation SECP256K1 implementation with no_std support. Currently we have implementation for: Convert

Parity Technologies 136 Sep 17, 2022
A Rust implementation of generic prefix tree (trie) map with wildcard capture support

prefix_tree_map A Rust implementation of generic prefix tree (trie) map with wildcard capture support. Design Trie is a good data structure for storin

EAimTY 2 Apr 22, 2022
fast rust implementation of online nonnegative matrix factorization as laid out in the paper "detect and track latent factors with online nonnegative matrix factorization"

ONMF status: early work in progress. still figuring this out. code still somewhat messy. api still in flux. fast rust implementation of online nonnega

null 2 Apr 10, 2020
An implementation of a predicative polymorphic language with bidirectional type inference and algebraic data types

Vinilla Lang Vanilla is a pure functional programming language based on System F, a classic but powerful type system. Merits Simple as it is, Vanilla

Zehao Chen 73 Aug 4, 2022