feat: add ChannelRss
- add documentation - small model refactor: rename player VideoPlayerDetails.thumbnails to thumbnail
This commit is contained in:
parent
6ac5bc3782
commit
305c3ee70e
29 changed files with 2222 additions and 118 deletions
|
|
@ -7,7 +7,6 @@ use anyhow::{anyhow, bail, Result};
|
|||
use chrono::{Local, NaiveDateTime, NaiveTime, TimeZone};
|
||||
use fancy_regex::Regex;
|
||||
use once_cell::sync::Lazy;
|
||||
use reqwest::Method;
|
||||
use serde::Serialize;
|
||||
use url::Url;
|
||||
|
||||
|
|
@ -98,7 +97,6 @@ impl RustyPipeQuery {
|
|||
client_type,
|
||||
"player",
|
||||
video_id,
|
||||
Method::POST,
|
||||
"player",
|
||||
&request_body,
|
||||
Some(&deobf),
|
||||
|
|
@ -175,7 +173,7 @@ impl MapResponse<VideoPlayer> for response::Player {
|
|||
title: video_details.title,
|
||||
description: video_details.short_description,
|
||||
length: video_details.length_seconds,
|
||||
thumbnails: video_details.thumbnail.into(),
|
||||
thumbnail: video_details.thumbnail.into(),
|
||||
channel: ChannelId {
|
||||
id: video_details.channel_id,
|
||||
name: video_details.author,
|
||||
|
|
@ -439,7 +437,7 @@ fn map_audio_stream(
|
|||
deobf: &Deobfuscator,
|
||||
last_nsig: &mut [String; 2],
|
||||
) -> MapResult<Option<AudioStream>> {
|
||||
static LANG_PATTERN: Lazy<Regex> = Lazy::new(|| Regex::new(r#"^([a-z]{2})\."#).unwrap());
|
||||
static LANG_PATTERN: Lazy<Regex> = Lazy::new(|| Regex::new(r#"^([a-z]{2,3})\."#).unwrap());
|
||||
|
||||
let (mtype, codecs) = some_or_bail!(
|
||||
parse_mime(&f.mime_type),
|
||||
|
|
@ -631,7 +629,7 @@ mod tests {
|
|||
#[case::android(ClientType::Android)]
|
||||
#[case::ios(ClientType::Ios)]
|
||||
#[test_log::test(tokio::test)]
|
||||
async fn t_get_player(#[case] client_type: ClientType) {
|
||||
async fn get_player(#[case] client_type: ClientType) {
|
||||
let rp = RustyPipe::builder().strict().build();
|
||||
let player_data = rp.query().player("n4tK7LYFxI0", client_type).await.unwrap();
|
||||
|
||||
|
|
@ -647,7 +645,7 @@ mod tests {
|
|||
));
|
||||
}
|
||||
assert_eq!(player_data.details.length, 259);
|
||||
assert!(!player_data.details.thumbnails.is_empty());
|
||||
assert!(!player_data.details.thumbnail.is_empty());
|
||||
assert_eq!(player_data.details.channel.id, "UC_aEa8K-EOJ3D6gOs7HcyNg");
|
||||
assert_eq!(player_data.details.channel.name, "NoCopyrightSounds");
|
||||
assert!(player_data.details.view_count > 146818808);
|
||||
|
|
@ -733,6 +731,18 @@ mod tests {
|
|||
assert!(player_data.expires_in_seconds > 10000);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn tmp() {
|
||||
let rp = RustyPipe::builder().strict().build();
|
||||
let player_data = rp
|
||||
.query()
|
||||
.player("tVWWp1PqDus", ClientType::Desktop)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
dbg!(&player_data);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn t_cipher_to_url() {
|
||||
let signature_cipher = "s=w%3DAe%3DA6aDNQLkViKS7LOm9QtxZJHKwb53riq9qEFw-ecBWJCAiA%3DcEg0tn3dty9jEHszfzh4Ud__bg9CEHVx4ix-7dKsIPAhIQRw8JQ0qOA&sp=sig&url=https://rr5---sn-h0jelnez.googlevideo.com/videoplayback%3Fexpire%3D1659376413%26ei%3Dvb7nYvH5BMK8gAfBj7ToBQ%26ip%3D2003%253Ade%253Aaf06%253A6300%253Ac750%253A1b77%253Ac74a%253A80e3%26id%3Do-AB_BABwrXZJN428ZwDxq5ScPn2AbcGODnRlTVhCQ3mj2%26itag%3D251%26source%3Dyoutube%26requiressl%3Dyes%26mh%3DhH%26mm%3D31%252C26%26mn%3Dsn-h0jelnez%252Csn-4g5ednsl%26ms%3Dau%252Conr%26mv%3Dm%26mvi%3D5%26pl%3D37%26initcwndbps%3D1588750%26spc%3DlT-Khi831z8dTejFIRCvCEwx_6romtM%26vprv%3D1%26mime%3Daudio%252Fwebm%26ns%3Db_Mq_qlTFcSGlG9RpwpM9xQH%26gir%3Dyes%26clen%3D3781277%26dur%3D229.301%26lmt%3D1655510291473933%26mt%3D1659354538%26fvip%3D5%26keepalive%3Dyes%26fexp%3D24001373%252C24007246%26c%3DWEB%26rbqsm%3Dfr%26txp%3D4532434%26n%3Dd2g6G2hVqWIXxedQ%26sparams%3Dexpire%252Cei%252Cip%252Cid%252Citag%252Csource%252Crequiressl%252Cspc%252Cvprv%252Cmime%252Cns%252Cgir%252Cclen%252Cdur%252Clmt%26lsparams%3Dmh%252Cmm%252Cmn%252Cms%252Cmv%252Cmvi%252Cpl%252Cinitcwndbps%26lsig%3DAG3C_xAwRQIgCKCGJ1iu4wlaGXy3jcJyU3inh9dr1FIfqYOZEG_MdmACIQCbungkQYFk7EhD6K2YvLaHFMjKOFWjw001_tLb0lPDtg%253D%253D";
|
||||
|
|
|
|||
Reference in a new issue