diff --git a/src/client/response/video_details.rs b/src/client/response/video_details.rs index 87b573a..c2fe982 100644 --- a/src/client/response/video_details.rs +++ b/src/client/response/video_details.rs @@ -27,7 +27,7 @@ pub struct VideoDetails { /// Video metadata + recommended videos pub contents: Contents, /// Video ID - pub current_video_endpoint: CurrentVideoEndpoint, + pub current_video_endpoint: Option, /// Video chapters + comment section #[serde_as(as = "VecLogError<_>")] pub engagement_panels: MapResult>, diff --git a/src/client/video_details.rs b/src/client/video_details.rs index 40d28ef..7a1e1f6 100644 --- a/src/client/video_details.rs +++ b/src/client/video_details.rs @@ -92,7 +92,11 @@ impl MapResponse for response::VideoDetails { ) -> Result, ExtractionError> { let mut warnings = Vec::new(); - let video_id = self.current_video_endpoint.watch_endpoint.video_id; + let current_video_endpoint = self + .current_video_endpoint + .ok_or_else(|| ExtractionError::ContentUnavailable("Video not found".into()))?; + + let video_id = current_video_endpoint.watch_endpoint.video_id; if id != video_id { return Err(ExtractionError::WrongResult(format!( "got wrong playlist id {}, expected {}", @@ -571,7 +575,6 @@ mod tests { let details: response::VideoDetails = serde_json::from_reader(BufReader::new(json_file)).unwrap(); - dbg!(&details); let map_res = details.map_response(id, Language::En, None).unwrap(); assert!( @@ -585,6 +588,21 @@ mod tests { }); } + #[test] + fn map_video_details_not_found() { + let filename = "testfiles/video_details/video_details_not_found.json"; + let json_path = Path::new(&filename); + let json_file = File::open(json_path).unwrap(); + + let details: response::VideoDetails = + serde_json::from_reader(BufReader::new(json_file)).unwrap(); + let err = details.map_response("", Language::En, None).unwrap_err(); + assert!(matches!( + err, + crate::error::ExtractionError::ContentUnavailable(_) + )) + } + #[test] fn t_map_recommendations() { let json_path = Path::new("testfiles/video_details/recommendations.json"); diff --git a/testfiles/video_details/video_details_not_found.json b/testfiles/video_details/video_details_not_found.json new file mode 100644 index 0000000..2dc0782 --- /dev/null +++ b/testfiles/video_details/video_details_not_found.json @@ -0,0 +1,1012 @@ +{ + "responseContext": { + "visitorData": "CgtPc0xxZ2Jaczd2WSiZyZeaBg%3D%3D", + "serviceTrackingParams": [ + { + "service": "CSI", + "params": [ + { + "key": "c", + "value": "WEB" + }, + { + "key": "cver", + "value": "2.20221011.00.00" + }, + { + "key": "yt_li", + "value": "0" + }, + { + "key": "GetWatchNext_rid", + "value": "0x1086768190a05ddc" + } + ] + }, + { + "service": "GFEEDBACK", + "params": [ + { + "key": "logged_in", + "value": "0" + }, + { + "key": "e", + "value": "1714257,23804281,23882502,23918597,23934970,23946420,23966208,23983296,23986028,23998056,24001373,24002022,24002025,24004644,24007246,24034168,24036948,24077241,24078244,24080738,24120819,24135310,24140247,24152442,24161116,24162920,24164186,24166867,24169501,24175559,24181174,24185614,24187043,24187377,24191629,24197450,24199724,24199774,24211178,24217535,24219713,24224266,24225483,24226335,24227844,24229161,24241068,24241378,24243988,24244166,24248385,24252037,24254502,24255543,24255545,24256985,24259940,24260783,24262346,24263796,24265820,24267564,24267570,24268142,24268870,24276619,24278546,24278596,24279196,24279628,24279852,24280997,24281669,24283093,24283280,24284943,24286003,24286019,24287327,24287795,24288043,24289901,24289939,24290131,24290257,24290270,24290487,24290842,24290971,24291585,24292296,24292955,24293803,24294175,24295361,24295634,24295896,24297742,24298641,24298797,24299357,24299748,24390674,24390916,24391539,24392058,24392269,24392405,24392543,24393338,24394729,24590921,39322278,39322399" + } + ] + }, + { + "service": "GUIDED_HELP", + "params": [ + { + "key": "logged_in", + "value": "0" + } + ] + }, + { + "service": "ECATCHER", + "params": [ + { + "key": "client.version", + "value": "2.20221011" + }, + { + "key": "client.name", + "value": "WEB" + }, + { + "key": "client.fexp", + "value": "24256985,24211178,24290842,24140247,24286019,24191629,24391539,24080738,24252037,24283280,24120819,24279628,24255545,24279196,24265820,24164186,24254502,24288043,24290487,24185614,24298641,24297742,24161116,39322399,24392269,24289939,24295361,24278596,24276619,24217535,24299357,24392543,24248385,24078244,24187043,24199724,24226335,24283093,24293803,24392058,24295896,24007246,23998056,24004644,24243988,24187377,24294175,24392405,24279852,24390916,24280997,24290270,24299748,24390674,24224266,23934970,24289901,24292296,24278546,24287327,24290131,24268870,24227844,24199774,24135310,24244166,24259940,24229161,24036948,23918597,24241378,24162920,24166867,24284943,24290257,39322278,24262346,24002025,24263796,24197450,24394729,24260783,24287795,24267564,24298797,23946420,24181174,23804281,24175559,24152442,23966208,24281669,24290971,24001373,24267570,1714257,24268142,24393338,24292955,24241068,24077241,24255543,24590921,24225483,24295634,24169501,24002022,24291585,23986028,23882502,24286003,24219713,24034168,23983296" + } + ] + } + ], + "mainAppWebResponseContext": { + "loggedOut": true + }, + "webResponseContextExtensionData": { + "hasDecorated": true + } + }, + "contents": { + "twoColumnWatchNextResults": { + "results": { + "results": { + "contents": [ + { + "itemSectionRenderer": { + "contents": [ + { + "backgroundPromoRenderer": { + "title": { + "runs": [ + { + "text": "This video isn't available anymore" + } + ] + }, + "trackingParams": "CBMQ92QYACITCL7SgtuT2foCFQy0VQodRusJ3A==", + "thumbnail": { + "thumbnails": [ + { + "url": "https://www.youtube.com/img/desktop/unavailable/unavailable_video.png", + "width": 278, + "height": 161 + } + ] + }, + "ctaButton": { + "buttonRenderer": { + "style": "STYLE_SUGGESTIVE", + "size": "SIZE_SMALL", + "text": { + "simpleText": "GO TO HOME" + }, + "navigationEndpoint": { + "clickTrackingParams": "CBQQup8IIhMIvtKC25PZ-gIVDLRVCh1G6wnc", + "commandMetadata": { + "webCommandMetadata": { + "url": "/", + "webPageType": "WEB_PAGE_TYPE_BROWSE", + "rootVe": 3854, + "apiUrl": "/youtubei/v1/browse" + } + }, + "browseEndpoint": { + "browseId": "FEwhat_to_watch" + } + }, + "trackingParams": "CBQQup8IIhMIvtKC25PZ-gIVDLRVCh1G6wnc" + } + }, + "style": { + "value": "BACKGROUND_PROMO_STYLE_TYPE_FULL_HEIGHT" + } + } + } + ], + "trackingParams": "CBIQuy8YACITCL7SgtuT2foCFQy0VQodRusJ3A==" + } + } + ], + "trackingParams": "CBEQui8iEwi-0oLbk9n6AhUMtFUKHUbrCdw=" + } + } + } + }, + "trackingParams": "CAAQg2ciEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "engagementPanels": [ + { + "engagementPanelSectionListRenderer": { + "content": { + "adsEngagementPanelContentRenderer": { + "hack": true + } + }, + "targetId": "engagement-panel-ads", + "visibility": "ENGAGEMENT_PANEL_VISIBILITY_HIDDEN", + "loggingDirectives": { + "trackingParams": "CBAQ040EGAAiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "visibility": { + "types": "12" + }, + "enableDisplayloggerExperiment": true + } + } + } + ], + "topbar": { + "desktopTopbarRenderer": { + "logo": { + "topbarLogoRenderer": { + "iconImage": { + "iconType": "YOUTUBE_LOGO" + }, + "tooltipText": { + "runs": [ + { + "text": "YouTube Home" + } + ] + }, + "endpoint": { + "clickTrackingParams": "CA8QsV4iEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "commandMetadata": { + "webCommandMetadata": { + "url": "/", + "webPageType": "WEB_PAGE_TYPE_BROWSE", + "rootVe": 3854, + "apiUrl": "/youtubei/v1/browse" + } + }, + "browseEndpoint": { + "browseId": "FEwhat_to_watch" + } + }, + "trackingParams": "CA8QsV4iEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "overrideEntityKey": "EgZ0b3BiYXIg9QEoAQ%3D%3D" + } + }, + "searchbox": { + "fusionSearchboxRenderer": { + "icon": { + "iconType": "SEARCH" + }, + "placeholderText": { + "runs": [ + { + "text": "Search" + } + ] + }, + "config": { + "webSearchboxConfig": { + "requestLanguage": "en", + "requestDomain": "us", + "hasOnscreenKeyboard": false, + "focusSearchbox": true + } + }, + "trackingParams": "CA0Q7VAiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "searchEndpoint": { + "clickTrackingParams": "CA0Q7VAiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "commandMetadata": { + "webCommandMetadata": { + "url": "/results?search_query=", + "webPageType": "WEB_PAGE_TYPE_SEARCH", + "rootVe": 4724 + } + }, + "searchEndpoint": { + "query": "" + } + }, + "clearButton": { + "buttonRenderer": { + "style": "STYLE_DEFAULT", + "size": "SIZE_DEFAULT", + "isDisabled": false, + "icon": { + "iconType": "CLOSE" + }, + "trackingParams": "CA4Q8FsiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "accessibilityData": { + "accessibilityData": { + "label": "Clear search query" + } + } + } + } + } + }, + "trackingParams": "CAEQq6wBIhMIvtKC25PZ-gIVDLRVCh1G6wnc", + "topbarButtons": [ + { + "topbarMenuButtonRenderer": { + "icon": { + "iconType": "MORE_VERT" + }, + "menuRequest": { + "clickTrackingParams": "CAsQ_qsBGAAiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "commandMetadata": { + "webCommandMetadata": { + "sendPost": true, + "apiUrl": "/youtubei/v1/account/account_menu" + } + }, + "signalServiceEndpoint": { + "signal": "GET_ACCOUNT_MENU", + "actions": [ + { + "clickTrackingParams": "CAsQ_qsBGAAiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "openPopupAction": { + "popup": { + "multiPageMenuRenderer": { + "trackingParams": "CAwQ_6sBIhMIvtKC25PZ-gIVDLRVCh1G6wnc", + "style": "MULTI_PAGE_MENU_STYLE_TYPE_SYSTEM", + "showLoadingSpinner": true + } + }, + "popupType": "DROPDOWN", + "beReused": true + } + } + ] + } + }, + "trackingParams": "CAsQ_qsBGAAiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "accessibility": { + "accessibilityData": { + "label": "Settings" + } + }, + "tooltip": "Settings", + "style": "STYLE_DEFAULT" + } + }, + { + "buttonRenderer": { + "style": "STYLE_SUGGESTIVE", + "size": "SIZE_SMALL", + "text": { + "runs": [ + { + "text": "Sign in" + } + ] + }, + "icon": { + "iconType": "AVATAR_LOGGED_OUT" + }, + "navigationEndpoint": { + "clickTrackingParams": "CAoQ1IAEGAEiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "commandMetadata": { + "webCommandMetadata": { + "url": "https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passive=true&continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26app%3Ddesktop%26hl%3Den%26next%3Dhttps%253A%252F%252Fwww.youtube.com%252Fyoutubei%252Fv1%252Fnext%253Fkey%253DAIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8%2526prettyPrint%253Dfalse&hl=en&ec=65620", + "webPageType": "WEB_PAGE_TYPE_UNKNOWN", + "rootVe": 83769 + } + }, + "signInEndpoint": { + "idamTag": "65620" + } + }, + "trackingParams": "CAoQ1IAEGAEiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "targetId": "topbar-signin" + } + } + ], + "hotkeyDialog": { + "hotkeyDialogRenderer": { + "title": { + "runs": [ + { + "text": "Keyboard shortcuts" + } + ] + }, + "sections": [ + { + "hotkeyDialogSectionRenderer": { + "title": { + "runs": [ + { + "text": "Playback" + } + ] + }, + "options": [ + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Toggle play/pause" + } + ] + }, + "hotkey": "k" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Rewind 10 seconds" + } + ] + }, + "hotkey": "j" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Fast forward 10 seconds" + } + ] + }, + "hotkey": "l" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Previous video" + } + ] + }, + "hotkey": "P (SHIFT+p)" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Next video" + } + ] + }, + "hotkey": "N (SHIFT+n)" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Previous frame (while paused)" + } + ] + }, + "hotkey": ",", + "hotkeyAccessibilityLabel": { + "accessibilityData": { + "label": "Comma" + } + } + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Next frame (while paused)" + } + ] + }, + "hotkey": ".", + "hotkeyAccessibilityLabel": { + "accessibilityData": { + "label": "Period" + } + } + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Decrease playback rate" + } + ] + }, + "hotkey": "< (SHIFT+,)", + "hotkeyAccessibilityLabel": { + "accessibilityData": { + "label": "Less than or SHIFT + comma" + } + } + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Increase playback rate" + } + ] + }, + "hotkey": "> (SHIFT+.)", + "hotkeyAccessibilityLabel": { + "accessibilityData": { + "label": "Greater than or SHIFT + period" + } + } + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Seek to specific point in the video (7 advances to 70% of duration)" + } + ] + }, + "hotkey": "0..9" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Seek to previous chapter" + } + ] + }, + "hotkey": "CONTROL + ←" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Seek to next chapter" + } + ] + }, + "hotkey": "CONTROL + →" + } + } + ] + } + }, + { + "hotkeyDialogSectionRenderer": { + "title": { + "runs": [ + { + "text": "General" + } + ] + }, + "options": [ + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Toggle full screen" + } + ] + }, + "hotkey": "f" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Toggle theater mode" + } + ] + }, + "hotkey": "t" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Toggle miniplayer" + } + ] + }, + "hotkey": "i" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Close miniplayer or current dialog" + } + ] + }, + "hotkey": "ESCAPE" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Toggle mute" + } + ] + }, + "hotkey": "m" + } + } + ] + } + }, + { + "hotkeyDialogSectionRenderer": { + "title": { + "runs": [ + { + "text": "Subtitles and closed captions" + } + ] + }, + "options": [ + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "If the video supports captions, toggle captions ON/OFF" + } + ] + }, + "hotkey": "c" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Rotate through different text opacity levels" + } + ] + }, + "hotkey": "o" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Rotate through different window opacity levels" + } + ] + }, + "hotkey": "w" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Rotate through font sizes (increasing)" + } + ] + }, + "hotkey": "+" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Rotate through font sizes (decreasing)" + } + ] + }, + "hotkey": "-", + "hotkeyAccessibilityLabel": { + "accessibilityData": { + "label": "Minus" + } + } + } + } + ] + } + }, + { + "hotkeyDialogSectionRenderer": { + "title": { + "runs": [ + { + "text": "Spherical Videos" + } + ] + }, + "options": [ + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Pan up" + } + ] + }, + "hotkey": "w" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Pan left" + } + ] + }, + "hotkey": "a" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Pan down" + } + ] + }, + "hotkey": "s" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Pan right" + } + ] + }, + "hotkey": "d" + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Zoom in" + } + ] + }, + "hotkey": "+ on numpad or ]", + "hotkeyAccessibilityLabel": { + "accessibilityData": { + "label": "Plus on number pad or right bracket" + } + } + } + }, + { + "hotkeyDialogSectionOptionRenderer": { + "label": { + "runs": [ + { + "text": "Zoom out" + } + ] + }, + "hotkey": "- on numpad or [", + "hotkeyAccessibilityLabel": { + "accessibilityData": { + "label": "Minus on number pad or left bracket" + } + } + } + } + ] + } + } + ], + "dismissButton": { + "buttonRenderer": { + "style": "STYLE_BLUE_TEXT", + "size": "SIZE_DEFAULT", + "isDisabled": false, + "text": { + "runs": [ + { + "text": "Dismiss" + } + ] + }, + "trackingParams": "CAkQ8FsiEwi-0oLbk9n6AhUMtFUKHUbrCdw=" + } + }, + "trackingParams": "CAgQteYDIhMIvtKC25PZ-gIVDLRVCh1G6wnc" + } + }, + "backButton": { + "buttonRenderer": { + "trackingParams": "CAcQvIYDIhMIvtKC25PZ-gIVDLRVCh1G6wnc", + "command": { + "clickTrackingParams": "CAcQvIYDIhMIvtKC25PZ-gIVDLRVCh1G6wnc", + "commandMetadata": { + "webCommandMetadata": { + "sendPost": true + } + }, + "signalServiceEndpoint": { + "signal": "CLIENT_SIGNAL", + "actions": [ + { + "clickTrackingParams": "CAcQvIYDIhMIvtKC25PZ-gIVDLRVCh1G6wnc", + "signalAction": { + "signal": "HISTORY_BACK" + } + } + ] + } + } + } + }, + "forwardButton": { + "buttonRenderer": { + "trackingParams": "CAYQvYYDIhMIvtKC25PZ-gIVDLRVCh1G6wnc", + "command": { + "clickTrackingParams": "CAYQvYYDIhMIvtKC25PZ-gIVDLRVCh1G6wnc", + "commandMetadata": { + "webCommandMetadata": { + "sendPost": true + } + }, + "signalServiceEndpoint": { + "signal": "CLIENT_SIGNAL", + "actions": [ + { + "clickTrackingParams": "CAYQvYYDIhMIvtKC25PZ-gIVDLRVCh1G6wnc", + "signalAction": { + "signal": "HISTORY_FORWARD" + } + } + ] + } + } + } + }, + "a11ySkipNavigationButton": { + "buttonRenderer": { + "style": "STYLE_DEFAULT", + "size": "SIZE_DEFAULT", + "isDisabled": false, + "text": { + "runs": [ + { + "text": "Skip navigation" + } + ] + }, + "trackingParams": "CAUQ8FsiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "command": { + "clickTrackingParams": "CAUQ8FsiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "commandMetadata": { + "webCommandMetadata": { + "sendPost": true + } + }, + "signalServiceEndpoint": { + "signal": "CLIENT_SIGNAL", + "actions": [ + { + "clickTrackingParams": "CAUQ8FsiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "signalAction": { + "signal": "SKIP_NAVIGATION" + } + } + ] + } + } + } + }, + "voiceSearchButton": { + "buttonRenderer": { + "style": "STYLE_DEFAULT", + "size": "SIZE_DEFAULT", + "isDisabled": false, + "serviceEndpoint": { + "clickTrackingParams": "CAIQ8FsiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "commandMetadata": { + "webCommandMetadata": { + "sendPost": true + } + }, + "signalServiceEndpoint": { + "signal": "CLIENT_SIGNAL", + "actions": [ + { + "clickTrackingParams": "CAIQ8FsiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "openPopupAction": { + "popup": { + "voiceSearchDialogRenderer": { + "placeholderHeader": { + "runs": [ + { + "text": "Listening..." + } + ] + }, + "promptHeader": { + "runs": [ + { + "text": "Didn't hear that. Try again." + } + ] + }, + "exampleQuery1": { + "runs": [ + { + "text": "\"Play Dua Lipa\"" + } + ] + }, + "exampleQuery2": { + "runs": [ + { + "text": "\"Show me my subscriptions\"" + } + ] + }, + "promptMicrophoneLabel": { + "runs": [ + { + "text": "Tap microphone to try again" + } + ] + }, + "loadingHeader": { + "runs": [ + { + "text": "Working..." + } + ] + }, + "connectionErrorHeader": { + "runs": [ + { + "text": "No connection" + } + ] + }, + "connectionErrorMicrophoneLabel": { + "runs": [ + { + "text": "Check your connection and try again" + } + ] + }, + "permissionsHeader": { + "runs": [ + { + "text": "Waiting for permission" + } + ] + }, + "permissionsSubtext": { + "runs": [ + { + "text": "Allow microphone access to search with voice" + } + ] + }, + "disabledHeader": { + "runs": [ + { + "text": "Search with your voice" + } + ] + }, + "disabledSubtext": { + "runs": [ + { + "text": "To search by voice, go to your browser settings and allow access to microphone" + } + ] + }, + "microphoneButtonAriaLabel": { + "runs": [ + { + "text": "Cancel" + } + ] + }, + "exitButton": { + "buttonRenderer": { + "style": "STYLE_DEFAULT", + "size": "SIZE_DEFAULT", + "isDisabled": false, + "icon": { + "iconType": "CLOSE" + }, + "trackingParams": "CAQQ8FsiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "accessibilityData": { + "accessibilityData": { + "label": "Cancel" + } + } + } + }, + "trackingParams": "CAMQ7q8FIhMIvtKC25PZ-gIVDLRVCh1G6wnc", + "microphoneOffPromptHeader": { + "runs": [ + { + "text": "Microphone off. Try again." + } + ] + } + } + }, + "popupType": "TOP_ALIGNED_DIALOG" + } + } + ] + } + }, + "icon": { + "iconType": "MICROPHONE_ON" + }, + "tooltip": "Search with your voice", + "trackingParams": "CAIQ8FsiEwi-0oLbk9n6AhUMtFUKHUbrCdw=", + "accessibilityData": { + "accessibilityData": { + "label": "Search with your voice" + } + } + } + } + } + } +} diff --git a/tests/youtube.rs b/tests/youtube.rs index 375fb71..0fc7c46 100644 --- a/tests/youtube.rs +++ b/tests/youtube.rs @@ -632,6 +632,17 @@ async fn get_video_details_agegate() { assert!(details.recommended.items.is_empty()); } +#[tokio::test] +async fn get_video_details_not_found() { + let rp = RustyPipe::builder().strict().build(); + let err = rp.query().video_details("abcdefgLi5X").await.unwrap_err(); + + assert!(matches!( + err, + Error::Extraction(ExtractionError::ContentUnavailable(_)) + )) +} + #[tokio::test] async fn get_video_recommendations() { let rp = RustyPipe::builder().strict().build();