Compare commits
1 commit
feat/timez
...
main
Author | SHA1 | Date | |
---|---|---|---|
2b891ca078 |
5 changed files with 40 additions and 27 deletions
|
@ -680,7 +680,11 @@ impl StreamsMapper {
|
||||||
itag: f.itag,
|
itag: f.itag,
|
||||||
bitrate: f.bitrate,
|
bitrate: f.bitrate,
|
||||||
average_bitrate: f.average_bitrate.unwrap_or(f.bitrate),
|
average_bitrate: f.average_bitrate.unwrap_or(f.bitrate),
|
||||||
size: f.content_length.unwrap(),
|
size: f.content_length.ok_or_else(|| {
|
||||||
|
ExtractionError::InvalidData(
|
||||||
|
format!("no audio content length. itag: {}", f.itag).into(),
|
||||||
|
)
|
||||||
|
})?,
|
||||||
index_range: f.index_range,
|
index_range: f.index_range,
|
||||||
init_range: f.init_range,
|
init_range: f.init_range,
|
||||||
duration_ms: f.approx_duration_ms,
|
duration_ms: f.approx_duration_ms,
|
||||||
|
|
|
@ -150,9 +150,7 @@ pub(crate) struct Format {
|
||||||
|
|
||||||
impl Format {
|
impl Format {
|
||||||
pub fn is_audio(&self) -> bool {
|
pub fn is_audio(&self) -> bool {
|
||||||
self.content_length.is_some()
|
self.audio_quality.is_some() && self.audio_sample_rate.is_some()
|
||||||
&& self.audio_quality.is_some()
|
|
||||||
&& self.audio_sample_rate.is_some()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_video(&self) -> bool {
|
pub fn is_video(&self) -> bool {
|
||||||
|
|
|
@ -100,6 +100,26 @@ VideoPlayer(
|
||||||
drm_track_type: None,
|
drm_track_type: None,
|
||||||
drm_systems: [],
|
drm_systems: [],
|
||||||
),
|
),
|
||||||
|
VideoStream(
|
||||||
|
url: "https://rr5---sn-h0jeenek.googlevideo.com/videoplayback?c=ANDROID&dur=163.096&ei=q1jpYtOPEYSBgQeHmqbwAQ&expire=1659481355&fexp=24001373%2C24007246&fvip=4&id=o-AEDMTCojVtwpIKOdhBaxEHE5s322qnAJHGqa2r1F46BM&initcwndbps=1527500&ip=2003%3Ade%3Aaf0e%3A2f00%3Ade47%3A297%3Aa6db%3A774e&itag=22&lmt=1580005750956837&lsig=AG3C_xAwRgIhAOiL-qJ04sA8FSOkEJfOYl3gFe4SzwYu_rAf3DMLHYigAiEA0Upi1HqqIu7NH_LTDL0jT1R5TTozQypL5FiSP9RoqtU%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&mh=mQ&mime=video%2Fmp4&mm=31%2C29&mn=sn-h0jeenek%2Csn-h0jelnez&ms=au%2Crdu&mt=1659459429&mv=m&mvi=5&pl=37&ratebypass=yes&rbqsm=fr&requiressl=yes&sig=AOq0QJ8wRAIgFlQZgR63Yz9UgY9gVqiyGDVkZmSmACRP3-MmKN7CRzQCIAMHAwZbHmWL1qNH4Nu3A0pXZwErXMVPzMIt-PyxeZqa&source=youtube&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cratebypass%2Cdur%2Clmt&txp=2211222&vprv=1",
|
||||||
|
itag: 22,
|
||||||
|
bitrate: 1574434,
|
||||||
|
average_bitrate: 1574434,
|
||||||
|
size: None,
|
||||||
|
index_range: None,
|
||||||
|
init_range: None,
|
||||||
|
duration_ms: Some(163096),
|
||||||
|
width: 1280,
|
||||||
|
height: 720,
|
||||||
|
fps: 30,
|
||||||
|
quality: "720p",
|
||||||
|
hdr: false,
|
||||||
|
mime: "video/mp4; codecs=\"avc1.64001F, mp4a.40.2\"",
|
||||||
|
format: mp4,
|
||||||
|
codec: avc1,
|
||||||
|
drm_track_type: None,
|
||||||
|
drm_systems: [],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
video_only_streams: [
|
video_only_streams: [
|
||||||
VideoStream(
|
VideoStream(
|
||||||
|
@ -232,26 +252,6 @@ VideoPlayer(
|
||||||
drm_track_type: None,
|
drm_track_type: None,
|
||||||
drm_systems: [],
|
drm_systems: [],
|
||||||
),
|
),
|
||||||
VideoStream(
|
|
||||||
url: "https://rr5---sn-h0jeenek.googlevideo.com/videoplayback?c=ANDROID&dur=163.096&ei=q1jpYtOPEYSBgQeHmqbwAQ&expire=1659481355&fexp=24001373%2C24007246&fvip=4&id=o-AEDMTCojVtwpIKOdhBaxEHE5s322qnAJHGqa2r1F46BM&initcwndbps=1527500&ip=2003%3Ade%3Aaf0e%3A2f00%3Ade47%3A297%3Aa6db%3A774e&itag=22&lmt=1580005750956837&lsig=AG3C_xAwRgIhAOiL-qJ04sA8FSOkEJfOYl3gFe4SzwYu_rAf3DMLHYigAiEA0Upi1HqqIu7NH_LTDL0jT1R5TTozQypL5FiSP9RoqtU%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&mh=mQ&mime=video%2Fmp4&mm=31%2C29&mn=sn-h0jeenek%2Csn-h0jelnez&ms=au%2Crdu&mt=1659459429&mv=m&mvi=5&pl=37&ratebypass=yes&rbqsm=fr&requiressl=yes&sig=AOq0QJ8wRAIgFlQZgR63Yz9UgY9gVqiyGDVkZmSmACRP3-MmKN7CRzQCIAMHAwZbHmWL1qNH4Nu3A0pXZwErXMVPzMIt-PyxeZqa&source=youtube&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cratebypass%2Cdur%2Clmt&txp=2211222&vprv=1",
|
|
||||||
itag: 22,
|
|
||||||
bitrate: 1574434,
|
|
||||||
average_bitrate: 1574434,
|
|
||||||
size: None,
|
|
||||||
index_range: None,
|
|
||||||
init_range: None,
|
|
||||||
duration_ms: Some(163096),
|
|
||||||
width: 1280,
|
|
||||||
height: 720,
|
|
||||||
fps: 30,
|
|
||||||
quality: "720p",
|
|
||||||
hdr: false,
|
|
||||||
mime: "video/mp4; codecs=\"avc1.64001F, mp4a.40.2\"",
|
|
||||||
format: mp4,
|
|
||||||
codec: avc1,
|
|
||||||
drm_track_type: None,
|
|
||||||
drm_systems: [],
|
|
||||||
),
|
|
||||||
VideoStream(
|
VideoStream(
|
||||||
url: "https://rr5---sn-h0jeenek.googlevideo.com/videoplayback?c=ANDROID&clen=22365208&dur=163.046&ei=q1jpYtOPEYSBgQeHmqbwAQ&expire=1659481355&fexp=24001373%2C24007246&fvip=4&gir=yes&id=o-AEDMTCojVtwpIKOdhBaxEHE5s322qnAJHGqa2r1F46BM&initcwndbps=1527500&ip=2003%3Ade%3Aaf0e%3A2f00%3Ade47%3A297%3Aa6db%3A774e&itag=398&keepalive=yes&lmt=1608048380553749&lsig=AG3C_xAwRgIhAOiL-qJ04sA8FSOkEJfOYl3gFe4SzwYu_rAf3DMLHYigAiEA0Upi1HqqIu7NH_LTDL0jT1R5TTozQypL5FiSP9RoqtU%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&mh=mQ&mime=video%2Fmp4&mm=31%2C29&mn=sn-h0jeenek%2Csn-h0jelnez&ms=au%2Crdu&mt=1659459429&mv=m&mvi=5&otfp=1&pl=37&rbqsm=fr&requiressl=yes&sig=AOq0QJ8wRAIgR6KqCOoig_FMl2tWKa7qHSmCjIZa9S7ABzEI16qdO2sCIFXccwql4bqV9CHlqXY4tgxyMFUsp7vW4XUjxs3AyG6H&source=youtube&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cotfp%2Cdur%2Clmt&txp=1311222&vprv=1",
|
url: "https://rr5---sn-h0jeenek.googlevideo.com/videoplayback?c=ANDROID&clen=22365208&dur=163.046&ei=q1jpYtOPEYSBgQeHmqbwAQ&expire=1659481355&fexp=24001373%2C24007246&fvip=4&gir=yes&id=o-AEDMTCojVtwpIKOdhBaxEHE5s322qnAJHGqa2r1F46BM&initcwndbps=1527500&ip=2003%3Ade%3Aaf0e%3A2f00%3Ade47%3A297%3Aa6db%3A774e&itag=398&keepalive=yes&lmt=1608048380553749&lsig=AG3C_xAwRgIhAOiL-qJ04sA8FSOkEJfOYl3gFe4SzwYu_rAf3DMLHYigAiEA0Upi1HqqIu7NH_LTDL0jT1R5TTozQypL5FiSP9RoqtU%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&mh=mQ&mime=video%2Fmp4&mm=31%2C29&mn=sn-h0jeenek%2Csn-h0jelnez&ms=au%2Crdu&mt=1659459429&mv=m&mvi=5&otfp=1&pl=37&rbqsm=fr&requiressl=yes&sig=AOq0QJ8wRAIgR6KqCOoig_FMl2tWKa7qHSmCjIZa9S7ABzEI16qdO2sCIFXccwql4bqV9CHlqXY4tgxyMFUsp7vW4XUjxs3AyG6H&source=youtube&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cotfp%2Cdur%2Clmt&txp=1311222&vprv=1",
|
||||||
itag: 398,
|
itag: 398,
|
||||||
|
|
|
@ -148,6 +148,20 @@ mod tests {
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn t_protobuilder() {
|
||||||
|
let mut pb = ProtoBuilder::new();
|
||||||
|
pb.varint(1, 128);
|
||||||
|
pb.varint(2, 1234567890);
|
||||||
|
pb.varint(3, 1234567890123456789);
|
||||||
|
pb.string(4, "Hello");
|
||||||
|
pb.bytes(5, &[1, 2, 3]);
|
||||||
|
assert_eq!(
|
||||||
|
pb.to_base64(),
|
||||||
|
"CIABENKF2MwEGJWCpu_HnoSRESIFSGVsbG8qAwECAw%3D%3D"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn t_parse_proto() {
|
fn t_parse_proto() {
|
||||||
let p = "GhhVQzl2cnZOU0wzeGNXR1NrVjg2UkVCU2c%3D";
|
let p = "GhhVQzl2cnZOU0wzeGNXR1NrVjg2UkVCU2c%3D";
|
||||||
|
|
|
@ -887,11 +887,8 @@ async fn channel_videos(rp: RustyPipe) {
|
||||||
#[rstest]
|
#[rstest]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn channel_shorts(rp: RustyPipe) {
|
async fn channel_shorts(rp: RustyPipe) {
|
||||||
let vd = rp.query().get_visitor_data().await.unwrap();
|
|
||||||
|
|
||||||
let channel = rp
|
let channel = rp
|
||||||
.query()
|
.query()
|
||||||
.visitor_data(vd)
|
|
||||||
.channel_videos_tab("UCh8gHdtzO2tXd593_bjErWg", ChannelVideoTab::Shorts)
|
.channel_videos_tab("UCh8gHdtzO2tXd593_bjErWg", ChannelVideoTab::Shorts)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Reference in a new issue