feat: add video details mapping

- TODO: fix fetching comment count
This commit is contained in:
ThetaDev 2022-09-20 16:14:57 +02:00
parent df6543d62e
commit e800e16c68
13 changed files with 38081 additions and 179 deletions

View file

@ -17,6 +17,7 @@ pub async fn download_testfiles(project_root: &Path) {
player_model(&testfiles),
playlist(&testfiles),
video_details(&testfiles),
comments_top(&testfiles),
);
}
@ -120,7 +121,6 @@ async fn playlist(testfiles: &Path) {
}
}
async fn video_details(testfiles: &Path) {
for (name, id) in [
("music", "MZOgTu2dMTg"),
@ -131,7 +131,6 @@ async fn video_details(testfiles: &Path) {
let mut json_path = testfiles.to_path_buf();
json_path.push("video_details");
json_path.push(format!("video_details_{}.json", name));
println!("{}", json_path.display());
if json_path.exists() {
continue;
}
@ -141,7 +140,46 @@ async fn video_details(testfiles: &Path) {
}
}
#[tokio::test]
async fn x() {
video_details(Path::new("../testfiles")).await;
async fn comments_top(testfiles: &Path) {
let mut json_path = testfiles.to_path_buf();
json_path.push("video_details");
json_path.push(format!("comments_top.json"));
if json_path.exists() {
return;
}
let rp = RustyPipe::new();
let details = rp.query().video_details("ZeerrnuLi5E").await.unwrap();
let rp = rp_testfile(&json_path);
rp.query().video_comments(&details.top_comments.ctoken.unwrap()).await.unwrap();
// rp.query().video_comments("Eg0SC0lITnpPSGk4c0pzGAYyJSIRIgtJSE56T0hpOHNKczAAeAJCEGNvbW1lbnRzLXNlY3Rpb24%3D").await.unwrap();
// Desktop 1
// top: Eg0SC0lITnpPSGk4c0pzGAYyJSIRIgtJSE56T0hpOHNKczAAeAJCEGNvbW1lbnRzLXNlY3Rpb24%3D
// latest: Eg0SC0lITnpPSGk4c0pzGAYyJSIRIgtJSE56T0hpOHNKczABeAJCEGNvbW1lbnRzLXNlY3Rpb24%3D
// shows count
// Desktop 2
// top: Eg0SC0lITnpPSGk4c0pzGAYyVSIuIgtJSE56T0hpOHNKczAAeAKqAhpVZ3lVZG5WQnBNR09tMnVMR3o1NEFhQUJBZzABQiFlbmdhZ2VtZW50LXBhbmVsLWNvbW1lbnRzLXNlY3Rpb24%3D
// shows no count
// latest: Eg0SC0lITnpPSGk4c0pzGAYyOCIRIgtJSE56T0hpOHNKczABeAIwAUIhZW5nYWdlbWVudC1wYW5lbC1jb21tZW50cy1zZWN0aW9u
// shows no count
// cont: Eg0SC0lITnpPSGk4c0pzGAYyJSIRIgtJSE56T0hpOHNKczAAeAJCEGNvbW1lbnRzLXNlY3Rpb24%3D
// shows count
}
#[tokio::test]
async fn test() {
let id = "IHNzOHi8sJs";
let rp = RustyPipe::new();
let details = rp.query().video_details(id).await.unwrap();
let ctoken_top = details.top_comments.ctoken;
let ctoken_latest = details.latest_comments.ctoken;
dbg!(ctoken_top);
dbg!(ctoken_latest);
}