CINXE.COM
Android Quickstart | YouTube Data API | Google Developers
<!doctype html> <html lang="en" dir="ltr"> <head><script type="text/javascript" src="/_static/js/bundle-playback.js?v=HxkREWBo" charset="utf-8"></script> <script type="text/javascript" src="/_static/js/wombat.js?v=txqj7nKC" charset="utf-8"></script> <script>window.RufflePlayer=window.RufflePlayer||{};window.RufflePlayer.config={"autoplay":"on","unmuteOverlay":"hidden"};</script> <script type="text/javascript" src="/_static/js/ruffle/ruffle.js"></script> <script type="text/javascript"> __wm.init("https://web.archive.org/web"); __wm.wombat("https://developers.google.com/youtube/v3/quickstart/android","20210518214143","https://web.archive.org/","web","/_static/", "1621374103"); </script> <link rel="stylesheet" type="text/css" href="/_static/css/banner-styles.css?v=S1zqJCYt" /> <link rel="stylesheet" type="text/css" href="/_static/css/iconochive.css?v=3PDvdIFv" /> <!-- End Wayback Rewrite JS Include --> <meta name="google-signin-client-id" content="721724668570-nbkv1cfusk7kk4eni4pjvepaus73b13t.apps.googleusercontent.com"> <meta name="google-signin-scope" content="profile email https://www.googleapis.com/auth/developerprofiles https://www.googleapis.com/auth/developerprofiles.award"> <meta property="og:site_name" content="Google Developers"> <meta property="og:type" content="website"><meta name="theme-color" content="#ff0000"><meta charset="utf-8"> <meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="manifest" href="/web/20210518214143/https://developers.google.com/_pwa/developers/manifest.json" crossorigin="use-credentials"> <link rel="preconnect" href="//web.archive.org/web/20210518214143/https://www.gstatic.com/" crossorigin> <link rel="preconnect" href="//web.archive.org/web/20210518214143/https://fonts.gstatic.com/" crossorigin> <link rel="preconnect" href="//web.archive.org/web/20210518214143/https://fonts.googleapis.com/" crossorigin> <link rel="preconnect" href="//web.archive.org/web/20210518214143/https://apis.google.com/" crossorigin> <link rel="preconnect" href="//web.archive.org/web/20210518214143/https://www.google-analytics.com/" crossorigin><link rel="stylesheet" href="//web.archive.org/web/20210518214143cs_/https://fonts.googleapis.com/css?family=Google+Sans:400,500|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700|Material+Icons&display=swap"><link rel="stylesheet" href="https://web.archive.org/web/20210518214143cs_/https://www.gstatic.com/devrel-devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/developers/css/app.css"><link rel="shortcut icon" href="https://web.archive.org/web/20210518214143im_/https://www.gstatic.com/devrel-devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/developers/images/favicon.png"> <link rel="apple-touch-icon" href="https://web.archive.org/web/20210518214143im_/https://www.gstatic.com/devrel-devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/developers/images/touchicon-180.png"><link rel="canonical" href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/android"><link rel="search" type="application/opensearchdescription+xml" title="Google Developers" href="https://web.archive.org/web/20210518214143/https://developers.google.com/s/opensearch.xml"> <title>Android Quickstart | YouTube Data API | Google Developers</title> <meta property="og:title" content="Android Quickstart | YouTube Data API | Google Developers"><meta property="og:url" content="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/android"><meta property="og:image" content="https://web.archive.org/web/20210518214143im_/https://www.gstatic.com/devrel-devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/developers/images/opengraph/youtube-theme.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="675"><meta property="og:locale" content="en"><meta name="twitter:card" content="summary_large_image"><script type="application/ld+json"> { "@context": "https://web.archive.org/web/20210518214143/https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "YouTube", "item": "https://web.archive.org/web/20210518214143/https://developers.google.com/youtube" },{ "@type": "ListItem", "position": 2, "name": "Data API", "item": "https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3" },{ "@type": "ListItem", "position": 3, "name": "Android Quickstart", "item": "https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/android" }] } </script> </head> <body class="" template="page" theme="youtube-theme" type="article" layout="docs" pending> <devsite-progress type="indeterminate" id="app-progress"></devsite-progress> <section class="devsite-wrapper"><devsite-header> <div class="devsite-header--inner nocontent"> <div class="devsite-top-logo-row-wrapper-wrapper"> <div class="devsite-top-logo-row-wrapper"> <div class="devsite-top-logo-row"> <button type="button" id="devsite-hamburger-menu" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Navigation menu button" visually-hidden aria-label="Open menu"> </button> <div class="devsite-product-name-wrapper"> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube"> <div class="devsite-product-logo-container" size="medium"> <img class="devsite-product-logo" alt="YouTube" src="https://web.archive.org/web/20210518214143im_/https://developers.google.com/site-assets/logo-youtube.svg" srcset="" sizes="64px" loading="lazy"> </div> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" aria-label="Product breadcrumb"> <li class="devsite-breadcrumb-item "> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Upper Header" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="YouTube"> YouTube </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Upper Header" data-value="2" track-type="globalNav" track-name="breadcrumb" track-metadata-position="2" track-metadata-eventdetail="YouTube Data API"> Data API </a> </li> </ul> </span> </div> <div class="devsite-top-logo-row-middle"> <div class="devsite-header-upper-tabs"> </div> <devsite-search aria-expanded="false" aria-haspopup="listbox" enable-signin enable-search enable-suggestions enable-query-completion project-name="YouTube Data API" tenant-name="Google Developers" project-scope="/youtube/v3" url-scoped="https://developers.google.com/s/results/youtube/v3" role="combobox"> <form class="devsite-search-form" action="https://web.archive.org/web/20210518214143/https://developers.google.com/s/results" method="GET"> <div class="devsite-search-container"> <div class="devsite-searchbox"> <input aria-activedescendant="" aria-autocomplete="list" aria-label="Search" aria-haspopup="false" aria-multiline="false" aria-label="Search box" autocomplete="off" class="devsite-search-field devsite-search-query" name="q" placeholder="Search" role="combobox" type="text" value=""> <div class="devsite-search-image material-icons" aria-hidden="true"></div> </div> <button type="button" search-open class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Open search"></button> </div> </form> <button type="button" search-close class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Close search"></button> </devsite-search> </div> <devsite-language-selector> <devsite-select class="devsite-language-selector-menu"> <select aria-label="Select your language preference." class="devsite-language-selector-select" name="language" track-name="click" track-type="languageSelector"> <option>Language</option> <option value="en" lang="en" track-metadata-original-language="en" track-metadata-selected-language="en" track-name="changed" track-type="languageSelector"> English </option> <option value="id" lang="id" track-metadata-original-language="en" track-metadata-selected-language="id" track-name="changed" track-type="languageSelector"> Bahasa Indonesia </option> <option value="de" lang="de" track-metadata-original-language="en" track-metadata-selected-language="de" track-name="changed" track-type="languageSelector"> Deutsch </option> <option value="es" lang="es" track-metadata-original-language="en" track-metadata-selected-language="es" track-name="changed" track-type="languageSelector"> Español </option> <option value="fr" lang="fr" track-metadata-original-language="en" track-metadata-selected-language="fr" track-name="changed" track-type="languageSelector"> Français </option> <option value="pt_br" lang="pt_br" track-metadata-original-language="en" track-metadata-selected-language="pt_br" track-name="changed" track-type="languageSelector"> Português – Brasil </option> <option value="ru" lang="ru" track-metadata-original-language="en" track-metadata-selected-language="ru" track-name="changed" track-type="languageSelector"> Русский </option> <option value="zh_cn" lang="zh_cn" track-metadata-original-language="en" track-metadata-selected-language="zh_cn" track-name="changed" track-type="languageSelector"> 中文 – 简体 </option> <option value="ja" lang="ja" track-metadata-original-language="en" track-metadata-selected-language="ja" track-name="changed" track-type="languageSelector"> 日本語 </option> <option value="ko" lang="ko" track-metadata-original-language="en" track-metadata-selected-language="ko" track-name="changed" track-type="languageSelector"> 한국어 </option> </select> </devsite-select> </devsite-language-selector> <devsite-user enable-profiles fp-auth id="devsite-user"></devsite-user> </div> </div> </div> <div class="devsite-collapsible-section "> <div class="devsite-header-background"> <div class="devsite-doc-set-nav-row"> <devsite-tabs class="lower-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Lower tabs"> <tab> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3" class="gc-analytics-event " track-type="globalNav" track-metadata-position="nav" track-metadata-eventdetail="nav" track-name="home" data-category="Site-Wide Custom Events" data-label="Tab: Home"> Home </a> </tab> <tab active> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3/getting-started" class="gc-analytics-event " track-type="globalNav" track-metadata-position="nav" track-metadata-eventdetail="nav" track-name="guides" aria-label="Guides, selected" data-category="Site-Wide Custom Events" data-label="Tab: Guides"> Guides </a> </tab> <tab> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3/docs" class="gc-analytics-event " track-type="globalNav" track-metadata-position="nav" track-metadata-eventdetail="nav" track-name="reference" data-category="Site-Wide Custom Events" data-label="Tab: Reference"> Reference </a> </tab> <tab> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3/code_samples" class="gc-analytics-event " track-type="globalNav" track-metadata-position="nav" track-metadata-eventdetail="nav" track-name="samples" data-category="Site-Wide Custom Events" data-label="Tab: Samples"> Samples </a> </tab> <tab> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3/support" class="gc-analytics-event " track-type="globalNav" track-metadata-position="nav" track-metadata-eventdetail="nav" track-name="support" data-category="Site-Wide Custom Events" data-label="Tab: Support"> Support </a> </tab> </nav> </devsite-tabs> </div> </div> </div> </div> </devsite-header> <devsite-book-nav scrollbars> <nav class="devsite-book-nav devsite-nav nocontent" aria-label="Side menu"> <div class="devsite-mobile-header"> <button type="button" id="devsite-close-nav" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close navigation" aria-label="Close navigation"> </button> <div class="devsite-product-name-wrapper"> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube"> <div class="devsite-product-logo-container" size="medium"> <img class="devsite-product-logo" alt="YouTube" src="https://web.archive.org/web/20210518214143im_/https://developers.google.com/site-assets/logo-youtube.svg" srcset="" sizes="64px" loading="lazy"> </div> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" aria-label="Upper header breadcrumb"> <li class="devsite-breadcrumb-item "> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Upper Header" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="YouTube"> YouTube </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Upper Header" data-value="2" track-type="globalNav" track-name="breadcrumb" track-metadata-position="2" track-metadata-eventdetail="YouTube Data API"> Data API </a> </li> </ul> </span> </div> </div> <div class="devsite-book-nav-wrapper"> <div class="devsite-mobile-nav-top"> <ul class="devsite-nav-list"> <li class="devsite-nav-item"> <a href="/web/20210518214143/https://developers.google.com/youtube/v3" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Home" track-type="navMenu" track-metadata-eventdetail="globalMenu" track-metadata-position="nav" track-name="home"> <span class="devsite-nav-text" tooltip> Home </span> </a> </li> <li class="devsite-nav-item"> <a href="/web/20210518214143/https://developers.google.com/youtube/v3/getting-started" class="devsite-nav-title gc-analytics-event devsite-nav-has-children devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Guides" track-type="navMenu" track-metadata-eventdetail="globalMenu" track-metadata-position="nav" track-name="guides"> <span class="devsite-nav-text" tooltip> Guides </span> <span class="devsite-nav-icon material-icons" data-icon="forward"> </span> </a> </li> <li class="devsite-nav-item"> <a href="/web/20210518214143/https://developers.google.com/youtube/v3/docs" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Reference" track-type="navMenu" track-metadata-eventdetail="globalMenu" track-metadata-position="nav" track-name="reference"> <span class="devsite-nav-text" tooltip> Reference </span> <span class="devsite-nav-icon material-icons" data-icon="forward"> </span> </a> </li> <li class="devsite-nav-item"> <a href="/web/20210518214143/https://developers.google.com/youtube/v3/code_samples" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Samples" track-type="navMenu" track-metadata-eventdetail="globalMenu" track-metadata-position="nav" track-name="samples"> <span class="devsite-nav-text" tooltip> Samples </span> <span class="devsite-nav-icon material-icons" data-icon="forward"> </span> </a> </li> <li class="devsite-nav-item"> <a href="/web/20210518214143/https://developers.google.com/youtube/v3/support" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Support" track-type="navMenu" track-metadata-eventdetail="globalMenu" track-metadata-position="nav" track-name="support"> <span class="devsite-nav-text" tooltip> Support </span> <span class="devsite-nav-icon material-icons" data-icon="forward"> </span> </a> </li> </ul> </div> <div class="devsite-mobile-nav-bottom" role="navigation"> <ul class="devsite-nav-list" menu="_book"> <li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/getting-started" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Overview</span></a></li> <li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/libraries" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Client Libraries</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"><span class="devsite-nav-text" tooltip>Authorize Requests</span></div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/authentication" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/registering_an_application" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Get Auth Credentials</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/auth/server-side-web-apps" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Server-side Web Apps</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/auth/client-side-web-apps" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Client-side Web Apps</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/auth/installed-apps" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Installed Apps</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/auth/devices" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Devices</span></a></li></ul></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"><span class="devsite-nav-text" tooltip>Quickstarts</span></div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/android" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Android</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/apps-script" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Apps Script</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/go" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Go</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/ios" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>iOS</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/java" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Java</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/js" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>JavaScript</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/nodejs" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Node.js</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/php" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>PHP</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/python" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Python</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/quickstart/ruby" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Ruby</span></a></li></ul></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"><span class="devsite-nav-text" tooltip>Guides and Tutorials</span></div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/determine_quota_cost" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Quota costs for API requests</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/uploading_a_video" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Upload a Video</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/using_resumable_upload_protocol" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Send Resumable Uploads</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/made_for_kids_status" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Find MadeForKids video status</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/push_notifications" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Subscribe to Push Notifications</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/working_with_channel_ids" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Work with Channel IDs</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/moving_to_oauth" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Move from ClientLogin to OAuth</span></a></li></ul></li> <li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/sample_requests" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Sample Requests</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"><span class="devsite-nav-text" tooltip>Implementation Guide</span></div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation/activities" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Activities</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation/captions" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Captions</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation/channels" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Channels</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation/comments" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Comments</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation/pagination" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Pagination</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation/partial" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Partial responses</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation/playlists" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Playlists</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation/ratings" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Ratings</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation/search" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Search requests</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation/subscriptions" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Subscriptions</span></a></li><li class="devsite-nav-item"><a href="/web/20210518214143/https://developers.google.com/youtube/v3/guides/implementation/videos" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>Videos</span></a></li></ul></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"><span class="devsite-nav-text" tooltip>Tools</span></div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-external"><a href="https://web.archive.org/web/20210518214143/https://developers.google.com/apis-explorer/#p/youtube/v3/" class="devsite-nav-title"><span class="devsite-nav-text" tooltip>APIs Explorer</span><span class="devsite-nav-icon material-icons" data-icon="external" data-title="External" aria-hidden="true"></span></a></li></ul></li> </ul> </div> </div> </nav> </devsite-book-nav> <section id="gc-wrapper"> <main role="main" class="devsite-main-content" has-book-nav has-toc> <devsite-toc class="devsite-nav"></devsite-toc> <devsite-content> <article class="devsite-article"> <div class="devsite-article-meta nocontent" role="navigation"> <ul class="devsite-breadcrumb-list" aria-label="Breadcrumb"> <li class="devsite-breadcrumb-item "> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail=""> Home </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/products" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="2" track-type="globalNav" track-name="breadcrumb" track-metadata-position="2" track-metadata-eventdetail=""> Products </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="3" track-type="globalNav" track-name="breadcrumb" track-metadata-position="3" track-metadata-eventdetail="YouTube"> YouTube </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="4" track-type="globalNav" track-name="breadcrumb" track-metadata-position="4" track-metadata-eventdetail="YouTube Data API"> Data API </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/youtube/v3/getting-started" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="5" track-type="globalNav" track-name="breadcrumb" track-metadata-position="5" track-metadata-eventdetail=""> Guides </a> </li> </ul> <devsite-thumb-rating position="header"> <template class="thumb-down-categories"> [{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples/Code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }] </template> <template class="thumb-up-categories"> [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }] </template> </devsite-thumb-rating> </div> <h1 class="devsite-page-title">Android Quickstart<devsite-bookmark></devsite-bookmark></h1> <devsite-toc class="devsite-nav" devsite-toc-embedded> </devsite-toc> <div class="devsite-article-body clearfix "> <style> .deprecated {color: red} </style> <style> ol { list-style-type: lower-alpha; } pre.terminal code::before { content: "$ "; color: #bdbdbd; } pre.terminal.dotnet code::before { content: "PM> "; } section.files header { text-transform: none; } </style> <p>This guide explains how to set up a simple Android application that makes requests to the YouTube Data API.</p> <aside class="special"><b>Note:</b> This quickstart demonstrates use of the YouTube Data API in an Android application. Many applications that use the Data API also use the <a href="/web/20210518214143/https://developers.google.com/youtube/android/player">YouTube Android Player API</a>, which lets you incorporate video playback functionality in an Android application.</aside> <h2 id="prerequisites" data-text="Prerequisites">Prerequisites</h2> <p>To run this quickstart, you'll need:</p> <ul> <li><a href="https://web.archive.org/web/20210518214143/https://developer.android.com/sdk/index.html">Android Studio SDK 1.2 or later</a>.</li> <li><a href="https://web.archive.org/web/20210518214143/https://developer.android.com/sdk/installing/adding-packages.html">Android SDK packages</a> for API 23 or later, including the latest versions of Google Repository, Android Support Library and Google Play Services.</li> <li>Access to the internet on your test device. </li> <li>A Google account. </li> </ul> <p>This quickstart will assume you are using the <a href="https://web.archive.org/web/20210518214143/https://developer.android.com/tools/studio/index.html">Android Studio</a> IDE (as opposed to the stand-alone SDK Tools) and are comfortable finding, creating and editing files within a Studio project.</p> <h2 id="step_1_acquire_a_sha1_fingerprint" data-text="Step 1: Acquire a SHA1 fingerprint">Step 1: Acquire a SHA1 fingerprint</h2> <p>In a terminal, run the folowing <a href="//web.archive.org/web/20210518214143/https://developer.android.com/guide/publishing/app-signing.html">Keytool utility</a> command to get the SHA1 fingerprint you will use to enable the API.</p> <pre class="devsite-click-to-copy terminal" translate="no" dir="ltr"> <code translate="no" dir="ltr">keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v</code> </pre> <p>When asked for a keystore password, enter "android".</p> <p>The Keytool prints the fingerprint to the shell. For example:</p> <pre style="background-color: #000; color:#fff" translate="no" dir="ltr">$ keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v Enter keystore password: <kbd>Type "android" if using debug.keystore</kbd> Alias name: androiddebugkey Creation date: Dec 4, 2014 Entry type: PrivateKeyEntry Certificate chain length: 1 Certificate[1]: Owner: CN=Android Debug, O=Android, C=US Issuer: CN=Android Debug, O=Android, C=US Serial number: 503bd581 Valid from: Mon Aug 27 13:16:01 PDT 2012 until: Wed Aug 20 13:16:01 PDT 2042 Certificate fingerprints: MD5: 1B:2B:2D:37:E1:CE:06:8B:A0:F0:73:05:3C:A3:63:DD SHA1: <b style="color: #007000;" title="Copy this text for creating the client ID">D8:AA:43:97:59:EE:C5:95:26:6A:07:EE:1C:37:8E:F4:F0:C8:05:C8</b> SHA256: F3:6F:98:51:9A:DF:C3:15:4E:48:4B:0F:91:E3:3C:6A:A0:97:DC:0A:3F:B2:D2:E1:FE:23:57:F5:EB:AC:13:30 Signature algorithm name: SHA1withRSA Version: 3</pre> <p>Copy the SHA1 fingerprint, which is <b style="color: #007000">highlighted</b> in the example above.</p> <aside class="special"><b>Important:</b> When you create a production app, you should not use the debug keystore. For more information, see <a href="//web.archive.org/web/20210518214143/https://developer.android.com/tools/publishing/app-signing.html"> Signing your applications</a>.</aside> <h2 id="step_2_turn_on_the" data-text="Step 2: Turn on the YouTube Data API">Step 2: Turn on the YouTube Data API</h2> <ol> <li> <p>Use <a href="https://web.archive.org/web/20210518214143/https://console.developers.google.com/start/api?id=youtube" target="_blank" class="gc-analytics-event" data-category="Quickstart" data-action="Enable" data-label="YouTube Data API, Android">this wizard</a> to create or select a project in the Google Developers Console and automatically turn on the API. Click <b>Continue</b>, then <b>Go to credentials</b>.</p> </li> <li> <p>On the <b>Create credentials</b> page, click the <b>Cancel</b> button.</p> </li> <li> <p>At the top of the page, select the <b>OAuth consent screen</b> tab. Select an <b>Email address</b>, enter a <b>Product name</b> if not already set, and click the <b>Save</b> button.</p> </li> <li> <p>Select the <b>Credentials</b> tab, click the <b>Create credentials</b> button and select <b>OAuth client ID</b>.</p> </li> <li>Select the application type <strong>Android</strong>.</li> <li>Copy the SHA1 fingerprint from Step 1 into the <strong>Signing-certificate fingerprint</strong> field.</li> <li>In the <a href="https://web.archive.org/web/20210518214143/https://developer.android.com/guide/topics/manifest/manifest-element.html#package"><strong>Package name</strong></a> field, enter <code translate="no" dir="ltr">com.example.quickstart</code>.</li> <li>Click the <strong>Create</strong> button.</li> </ol> <h2 id="step_3_create_a_new_android_project" data-text="Step 3: Create a new Android project">Step 3: Create a new Android project</h2> <ol> <li>Open <a href="https://web.archive.org/web/20210518214143/https://developer.android.com/tools/studio/index.html">Android Studio</a>, and start a New Android Studio Project.</li> <li>In the <strong>New Project</strong> screen, name the application "Quickstart".</li> <li>Set <strong>Company Domain</strong> to "example.com" and verify that the package name automatically produced matches the one you entered into the <a href="https://web.archive.org/web/20210518214143/https://console.developers.google.com/">Developer Console</a> in Step 2. Click <strong>Next</strong>.</li> <li>In the <strong>Target Android Devices</strong> screen, check the <strong>Phone and Tablet</strong> checkbox and choose a <strong>Minimum SDK</strong> of "API 14: Android 4.0 (IceCreamSandwich)". Leave the other checkboxes unchecked. Click <strong>Next</strong>.</li> <li>In the <strong>Add an activity to Mobile</strong> screen, click <strong>Add No Activity</strong>.</li> <li>Click <strong>Finish</strong>.</li> </ol> <p>At this point, <a href="https://web.archive.org/web/20210518214143/https://developer.android.com/tools/studio/index.html">Android Studio</a> creates and opens the project.</p> <h2 id="step_4_prepare_the_project" data-text="Step 4: Prepare the project">Step 4: Prepare the project</h2> <p>The Project sidebar is an expandable list of the default project files that <a href="https://web.archive.org/web/20210518214143/https://developer.android.com/tools/studio/index.html">Android Studio</a> has created. In that list, expand the list of Gradle scripts and open the <code translate="no" dir="ltr">build.gradle</code> file that is associated with the "app" module (not the project).</p> <aside class="warning"><b>Warning:</b> Be sure to open the correct <code translate="no" dir="ltr">build.gradle</code> file. The first line should read <code translate="no" dir="ltr">apply plugin: 'com.android.application'</code>.</aside> <ol> <li>Open the app <code translate="no" dir="ltr">build.gradle</code> file and replace its contents with the following: <devsite-iframe><iframe src="/web/20210518214143if_/https://developers.google.com/youtube/v3/quickstart/android_df068a75e8a334885fcf6b2cfcb70601f47f83fbcb12fa0fce3c6f06b18ffcc9.frame" class="framebox inherit-locale " allowfullscreen is-upgraded></iframe></devsite-iframe></li> <li>In the toolbar, select <strong>Tools > Android > Sync Project with Gradle Files</strong>. This will acquire and make available the libraries your project needs.</li> <li>Find and open the default <code translate="no" dir="ltr">src/main/AndroidManifest.xml</code> file. In the Project sidebar, this file is nested under <code translate="no" dir="ltr">app</code> and then under <code translate="no" dir="ltr">manifests</code>. Replace the file's contents with the following code: <pre class="prettyprint" translate="no" dir="ltr"> <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.quickstart"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="YouTube Data API Android Quickstart" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="YouTube Data API Android Quickstart" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest></pre></li> </ol> <h2 id="step_5_setup_the_sample" data-text="Step 5: Setup the sample">Step 5: Setup the sample</h2> <aside class="special"><b>Note:</b> For simplicity, this quickstart builds its layout dynamically and uses hardcoded string constants. Most Android applications, however, benefit from defining layouts, strings and other resources in <a href="https://web.archive.org/web/20210518214143/https://developer.android.com/guide/topics/resources/overview.html">XML resource files</a>.</aside> <p>Create a new Java class. To do so, first select the <code translate="no" dir="ltr">java</code> folder in the Project sidebar. This folder appears in the group of <code translate="no" dir="ltr">app</code> files. After clicking on the folder, you can select <nobr><strong>File</strong> > <strong>New</strong> > <strong>Java Class</strong></nobr> from the menu bar, or you can right-click on the folder and select <nobr><strong>New</strong> > <strong>Java Class</strong></nobr>. If prompted to select a directory, choose <code translate="no" dir="ltr">.../app/src/main/java</code>.</p> <p>Name the class "MainActivity" and click <strong>OK</strong>. Replace the contents of the new file with the following code.</p> <pre class="prettyprint" translate="no" dir="ltr"> package com.example.quickstart; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GoogleApiAvailability; import com.google.api.client.extensions.android.http.AndroidHttp; import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential; import com.google.api.client.googleapis.extensions.android.gms.auth.GooglePlayServicesAvailabilityIOException; import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.util.ExponentialBackOff; import com.google.api.services.youtube.YouTubeScopes; import com.google.api.services.youtube.model.*; import android.Manifest; import android.accounts.AccountManager; import android.app.Activity; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.NonNull; import android.text.TextUtils; import android.text.method.ScrollingMovementMethod; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import pub.devrel.easypermissions.AfterPermissionGranted; import pub.devrel.easypermissions.EasyPermissions; public class MainActivity extends Activity implements EasyPermissions.PermissionCallbacks { GoogleAccountCredential mCredential; private TextView mOutputText; private Button mCallApiButton; ProgressDialog mProgress; static final int REQUEST_ACCOUNT_PICKER = 1000; static final int REQUEST_AUTHORIZATION = 1001; static final int REQUEST_GOOGLE_PLAY_SERVICES = 1002; static final int REQUEST_PERMISSION_GET_ACCOUNTS = 1003; private static final String BUTTON_TEXT = "Call YouTube Data API"; private static final String PREF_ACCOUNT_NAME = "accountName"; private static final String[] SCOPES = { YouTubeScopes.YOUTUBE_READONLY }; /** * Create the main activity. * @param savedInstanceState previously saved instance data. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout activityLayout = new LinearLayout(this); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); activityLayout.setLayoutParams(lp); activityLayout.setOrientation(LinearLayout.VERTICAL); activityLayout.setPadding(16, 16, 16, 16); ViewGroup.LayoutParams tlp = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); mCallApiButton = new Button(this); mCallApiButton.setText(BUTTON_TEXT); mCallApiButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mCallApiButton.setEnabled(false); mOutputText.setText(""); getResultsFromApi(); mCallApiButton.setEnabled(true); } }); activityLayout.addView(mCallApiButton); mOutputText = new TextView(this); mOutputText.setLayoutParams(tlp); mOutputText.setPadding(16, 16, 16, 16); mOutputText.setVerticalScrollBarEnabled(true); mOutputText.setMovementMethod(new ScrollingMovementMethod()); mOutputText.setText( "Click the \'" + BUTTON_TEXT +"\' button to test the API."); activityLayout.addView(mOutputText); mProgress = new ProgressDialog(this); mProgress.setMessage("Calling YouTube Data API ..."); setContentView(activityLayout); // Initialize credentials and service object. mCredential = GoogleAccountCredential.usingOAuth2( getApplicationContext(), Arrays.asList(SCOPES)) .setBackOff(new ExponentialBackOff()); } /** * Attempt to call the API, after verifying that all the preconditions are * satisfied. The preconditions are: Google Play Services installed, an * account was selected and the device currently has online access. If any * of the preconditions are not satisfied, the app will prompt the user as * appropriate. */ private void getResultsFromApi() { if (! isGooglePlayServicesAvailable()) { acquireGooglePlayServices(); } else if (mCredential.getSelectedAccountName() == null) { chooseAccount(); } else if (! isDeviceOnline()) { mOutputText.setText("No network connection available."); } else { new MakeRequestTask(mCredential).execute(); } } /** * Attempts to set the account used with the API credentials. If an account * name was previously saved it will use that one; otherwise an account * picker dialog will be shown to the user. Note that the setting the * account to use with the credentials object requires the app to have the * GET_ACCOUNTS permission, which is requested here if it is not already * present. The AfterPermissionGranted annotation indicates that this * function will be rerun automatically whenever the GET_ACCOUNTS permission * is granted. */ @AfterPermissionGranted(REQUEST_PERMISSION_GET_ACCOUNTS) private void chooseAccount() { if (EasyPermissions.hasPermissions( this, Manifest.permission.GET_ACCOUNTS)) { String accountName = getPreferences(Context.MODE_PRIVATE) .getString(PREF_ACCOUNT_NAME, null); if (accountName != null) { mCredential.setSelectedAccountName(accountName); getResultsFromApi(); } else { // Start a dialog from which the user can choose an account startActivityForResult( mCredential.newChooseAccountIntent(), REQUEST_ACCOUNT_PICKER); } } else { // Request the GET_ACCOUNTS permission via a user dialog EasyPermissions.requestPermissions( this, "This app needs to access your Google account (via Contacts).", REQUEST_PERMISSION_GET_ACCOUNTS, Manifest.permission.GET_ACCOUNTS); } } /** * Called when an activity launched here (specifically, AccountPicker * and authorization) exits, giving you the requestCode you started it with, * the resultCode it returned, and any additional data from it. * @param requestCode code indicating which activity result is incoming. * @param resultCode code indicating the result of the incoming * activity result. * @param data Intent (containing result data) returned by incoming * activity result. */ @Override protected void onActivityResult( int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch(requestCode) { case REQUEST_GOOGLE_PLAY_SERVICES: if (resultCode != RESULT_OK) { mOutputText.setText( "This app requires Google Play Services. Please install " + "Google Play Services on your device and relaunch this app."); } else { getResultsFromApi(); } break; case REQUEST_ACCOUNT_PICKER: if (resultCode == RESULT_OK && data != null && data.getExtras() != null) { String accountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME); if (accountName != null) { SharedPreferences settings = getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = settings.edit(); editor.putString(PREF_ACCOUNT_NAME, accountName); editor.apply(); mCredential.setSelectedAccountName(accountName); getResultsFromApi(); } } break; case REQUEST_AUTHORIZATION: if (resultCode == RESULT_OK) { getResultsFromApi(); } break; } } /** * Respond to requests for permissions at runtime for API 23 and above. * @param requestCode The request code passed in * requestPermissions(android.app.Activity, String, int, String[]) * @param permissions The requested permissions. Never null. * @param grantResults The grant results for the corresponding permissions * which is either PERMISSION_GRANTED or PERMISSION_DENIED. Never null. */ @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); EasyPermissions.onRequestPermissionsResult( requestCode, permissions, grantResults, this); } /** * Callback for when a permission is granted using the EasyPermissions * library. * @param requestCode The request code associated with the requested * permission * @param list The requested permission list. Never null. */ @Override public void onPermissionsGranted(int requestCode, List<String> list) { // Do nothing. } /** * Callback for when a permission is denied using the EasyPermissions * library. * @param requestCode The request code associated with the requested * permission * @param list The requested permission list. Never null. */ @Override public void onPermissionsDenied(int requestCode, List<String> list) { // Do nothing. } /** * Checks whether the device currently has a network connection. * @return true if the device has a network connection, false otherwise. */ private boolean isDeviceOnline() { ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); return (networkInfo != null && networkInfo.isConnected()); } /** * Check that Google Play services APK is installed and up to date. * @return true if Google Play Services is available and up to * date on this device; false otherwise. */ private boolean isGooglePlayServicesAvailable() { GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); final int connectionStatusCode = apiAvailability.isGooglePlayServicesAvailable(this); return connectionStatusCode == ConnectionResult.SUCCESS; } /** * Attempt to resolve a missing, out-of-date, invalid or disabled Google * Play Services installation via a user dialog, if possible. */ private void acquireGooglePlayServices() { GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); final int connectionStatusCode = apiAvailability.isGooglePlayServicesAvailable(this); if (apiAvailability.isUserResolvableError(connectionStatusCode)) { showGooglePlayServicesAvailabilityErrorDialog(connectionStatusCode); } } /** * Display an error dialog showing that Google Play Services is missing * or out of date. * @param connectionStatusCode code describing the presence (or lack of) * Google Play Services on this device. */ void showGooglePlayServicesAvailabilityErrorDialog( final int connectionStatusCode) { GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); Dialog dialog = apiAvailability.getErrorDialog( MainActivity.this, connectionStatusCode, REQUEST_GOOGLE_PLAY_SERVICES); dialog.show(); } /** * An asynchronous task that handles the YouTube Data API call. * Placing the API calls in their own task ensures the UI stays responsive. */ private class MakeRequestTask extends AsyncTask<Void, Void, List<String>> { private com.google.api.services.youtube.YouTube mService = null; private Exception mLastError = null; MakeRequestTask(GoogleAccountCredential credential) { HttpTransport transport = AndroidHttp.newCompatibleTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); mService = new com.google.api.services.youtube.YouTube.Builder( transport, jsonFactory, credential) .setApplicationName("YouTube Data API Android Quickstart") .build(); } /** * Background task to call YouTube Data API. * @param params no parameters needed for this task. */ @Override protected List<String> doInBackground(Void... params) { try { return getDataFromApi(); } catch (Exception e) { mLastError = e; cancel(true); return null; } } /** * Fetch information about the "GoogleDevelopers" YouTube channel. * @return List of Strings containing information about the channel. * @throws IOException */ private List<String> getDataFromApi() throws IOException { // Get a list of up to 10 files. List<String> channelInfo = new ArrayList<String>(); ChannelListResponse result = mService.channels().list("snippet,contentDetails,statistics") .setForUsername("GoogleDevelopers") .execute(); List<Channel> channels = result.getItems(); if (channels != null) { Channel channel = channels.get(0); channelInfo.add("This channel's ID is " + channel.getId() + ". " + "Its title is '" + channel.getSnippet().getTitle() + ", " + "and it has " + channel.getStatistics().getViewCount() + " views."); } return channelInfo; } @Override protected void onPreExecute() { mOutputText.setText(""); mProgress.show(); } @Override protected void onPostExecute(List<String> output) { mProgress.hide(); if (output == null || output.size() == 0) { mOutputText.setText("No results returned."); } else { output.add(0, "Data retrieved using the YouTube Data API:"); mOutputText.setText(TextUtils.join("\n", output)); } } @Override protected void onCancelled() { mProgress.hide(); if (mLastError != null) { if (mLastError instanceof GooglePlayServicesAvailabilityIOException) { showGooglePlayServicesAvailabilityErrorDialog( ((GooglePlayServicesAvailabilityIOException) mLastError) .getConnectionStatusCode()); } else if (mLastError instanceof UserRecoverableAuthIOException) { startActivityForResult( ((UserRecoverableAuthIOException) mLastError).getIntent(), MainActivity.REQUEST_AUTHORIZATION); } else { mOutputText.setText("The following error occurred:\n" + mLastError.getMessage()); } } else { mOutputText.setText("Request cancelled."); } } } }</pre> <h2 id="step_6_run_the_app" data-text="Step 6: Run the app">Step 6: Run the app</h2> <ol> <li>To test the app, click the <strong>Run > Run app</strong> menu item.</li> <li>You will be prompted to select a connected device (recommended) or emulation to run the app on. If you run on an emulation, make sure it is configured to use one of the <strong>with Google APIs</strong> system images. If you attempt to run the quickstart on a device that does not currently have Google Play services installed, the quickstart produces a dialog from which you can install it.</li> <li>If running on an emulator, allow it to fully start and establish its network connection.</li> <li>If starting the emulator for the first time, you may need to unlock its screen. Regardless, the quickstart app should start automatically.</li> <li>The first time that you run the app, it prompts you to specify an account. Complete the sign-in flow to choose an account to connect to.</li> <li>After selecting an account, the app prompts you to authorize access. Click <strong>OK</strong> to authorize.</li> </ol> <style> #quickstart-feedback-question { margin: 1em 0; position: relative; } #quickstart-feedback-question section.expandable { position: static; } </style> <div id="quickstart-feedback-question"> <section class="expandable"> <button class="button button-blue expand-control gc-analytics-event" data-category="Quickstart" data-action="Feedback" data-label="YouTube Data API, Android" data-value="1"> It worked! </button> <aside id="quickstart-feedback-success" class="success"> <strong>Great!</strong> Check out the further reading section below to learn more. </aside> </section> <section class="expandable"> <button class="button expand-control gc-analytics-event" data-category="Quickstart" data-action="Feedback" data-label="YouTube Data API, Android" data-value="0" style="position: absolute; top: 0; left: 110px;"> I got an error </button> <aside id="quickstart-feedback-failure" class="warning"> <strong>Bummer.</strong> Check out our <a href="#troubleshooting">troubleshooting</a> section below for some common errors and solutions. Thanks for letting us know and we'll work to fix this quickstart. </aside> </section> </div> <h2 id="notes" data-text="Notes">Notes</h2> <ul> <li>Authorization information is stored with the app, so subsequent executions do not prompt for authorization.</li> </ul> <h2 id="further_reading" data-text="Further reading">Further reading</h2> <ul> <li><a href="/web/20210518214143/https://developers.google.com/console/help/new">Google Developers Console help documentation</a></li> <li><a href="/web/20210518214143/https://developers.google.com/api-client-library/java">Google APIs Client for Java documentation</a></li> <li><a href="https://web.archive.org/web/20210518214143/https://developer.android.com/guide/index.html">Android API Guides</a></li> <li><a href="https://web.archive.org/web/20210518214143/https://developer.android.com/google/play-services/index.html">Google Play Services</a> <li><a href="/web/20210518214143/https://developers.google.com/youtube/v3/docs">YouTube Data API reference documentation</a></li> </li> </ul> <h2 id="troubleshooting" data-text="Troubleshooting">Troubleshooting</h2> <h4 id="unregistered_android_application" data-text="Unregistered Android application">Unregistered Android application</h4> <p>When the OAuth dialog contains an entry that reads "Unregistered Android application," it means that the OAuth2 client ID you created in Step 2 cannot be found and Android is falling back to a default client. The default client won't be configured to use this API, so requests fail with errors like <code translate="no" dir="ltr">accessNotConfigured.</code> These errors might also mention the default project number <code translate="no" dir="ltr">608941808256</code>.</p> <p>To fix the issue, make sure the SHA1 fingerprint that you retrieved in Step 1 and the <code translate="no" dir="ltr">applicationId</code> listed in your <code translate="no" dir="ltr">build.gradle</code> file match exactly with the values that you set in the Google Developers console.</p> </div> <devsite-thumb-rating position="footer"> <template class="thumb-down-categories"> [{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples/Code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }] </template> <template class="thumb-up-categories"> [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }] </template> </devsite-thumb-rating> </article> <devsite-content-footer class="nocontent"> <p>Except as otherwise noted, the content of this page is licensed under the <a href="https://web.archive.org/web/20210518214143/https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 License</a>, and code samples are licensed under the <a href="https://web.archive.org/web/20210518214143/https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 License</a>. For details, see the <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/site-policies">Google Developers Site Policies</a>. Java is a registered trademark of Oracle and/or its affiliates.</p> <p>Last updated 2021-05-14 UTC.</p> </devsite-content-footer> </devsite-content> </main> <devsite-footer-promos class="devsite-footer"> <nav class="devsite-footer-promos nocontent" aria-label="Promotions"> <ul class="devsite-footer-promos-list"> <li class="devsite-footer-promo"> <a href="https://web.archive.org/web/20210518214143/http://apiblog.youtube.com/" class="devsite-footer-promo-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Promo Link (index 1)"> <img class="devsite-footer-promo-icon" src="https://web.archive.org/web/20210518214143im_/https://www.gstatic.com/images/icons/material/product/2x/blogger_64dp.png" loading="lazy" alt="Blog"> Blog </a> <div class="devsite-footer-promo-description">The latest news on the YouTube API blog</div> </li> <li class="devsite-footer-promo"> <a href="https://web.archive.org/web/20210518214143/https://github.com/youtube/api-samples" class="devsite-footer-promo-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Promo Link (index 2)"> <img class="devsite-footer-promo-icon" src="/web/20210518214143im_/https://developers.google.com/site-assets/logo-github.svg" loading="lazy" alt="GitHub"> GitHub </a> <div class="devsite-footer-promo-description">Find API code samples and other YouTube open-source projects.</div> </li> <li class="devsite-footer-promo"> <a href="https://web.archive.org/web/20210518214143/https://issuetracker.google.com/issues/new?component=186600&template=874803" class="devsite-footer-promo-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Promo Link (index 3)"> <img class="devsite-footer-promo-icon" src="/web/20210518214143im_/https://developers.google.com/site-assets/developers_64dp.png" loading="lazy" alt="Issue Tracker"> Issue Tracker </a> <div class="devsite-footer-promo-description">Something wrong? Send us a bug report!</div> </li> <li class="devsite-footer-promo"> <a href="https://web.archive.org/web/20210518214143/http://stackoverflow.com/questions/ask?tags=youtube-api" class="devsite-footer-promo-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Promo Link (index 4)"> <img class="devsite-footer-promo-icon" src="/web/20210518214143im_/https://developers.google.com/site-assets/logo-stack-overflow.svg" loading="lazy" alt="Stack Overflow"> Stack Overflow </a> <div class="devsite-footer-promo-description">Ask a question under the youtube-api tag</div> </li> <li class="devsite-footer-promo"> <a href="https://web.archive.org/web/20210518214143/https://www.youtube.com/user/YouTubeDev" class="devsite-footer-promo-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Promo Link (index 5)"> <img class="devsite-footer-promo-icon" src="/web/20210518214143im_/https://developers.google.com/site-assets/logo-youtube.svg" loading="lazy" alt="Videos"> Videos </a> <div class="devsite-footer-promo-description">Check out the YouTube Developer Relations team's YouTube channel</div> </li> </ul> </nav> </devsite-footer-promos> <devsite-footer-linkboxes class="devsite-footer"> <nav class="devsite-footer-linkboxes nocontent" aria-label="Footer links"> <ul class="devsite-footer-linkboxes-list"> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Tools</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/apis-explorer/#p/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)"> Google APIs Explorer </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/web/20210518214143/https://developers.google.com/youtube/youtube_player_demo" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)"> YouTube Player Demo </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/web/20210518214143/https://developers.google.com/youtube/youtube_subscribe_button" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)"> Configure a Subscribe Button </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Issue Tracker</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="https://web.archive.org/web/20210518214143/https://issuetracker.google.com/issues/new?component=186600&template=874803" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)"> File a bug </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://web.archive.org/web/20210518214143/https://issuetracker.google.com/issues/new?component=186600&template=874803" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)"> Request a feature </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://web.archive.org/web/20210518214143/https://issuetracker.google.com/issues?q=componentid:186600" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)"> See open issues </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Product Info</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/web/20210518214143/https://developers.google.com/youtube/terms" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)"> Terms of Service </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/web/20210518214143/https://developers.google.com/youtube/branding_guidelines" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)"> Branding Guidelines </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/web/20210518214143/https://developers.google.com/youtube/creating_monetizable_applications" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)"> Monetization Guidelines </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/web/20210518214143/https://developers.google.com/youtube/youtube-api-list" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)"> APIs subject to Deprecation Policy </a> </li> </ul> </li> </ul> </nav> </devsite-footer-linkboxes> <devsite-footer-utility class="devsite-footer"> <div class="devsite-footer-utility nocontent"> <nav class="devsite-footer-sites" aria-label="Other Google Developers websites"> <a href="https://web.archive.org/web/20210518214143/https://developers.google.com/" class="devsite-footer-sites-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Google Developers Link"> <img class="devsite-footer-sites-logo" src="https://web.archive.org/web/20210518214143im_/https://www.gstatic.com/devrel-devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/developers/images/lockup-developers.svg" loading="lazy" alt="Google Developers"> </a> <ul class="devsite-footer-sites-list"> <li class="devsite-footer-sites-item"> <a href="//web.archive.org/web/20210518214143/https://developer.android.com/" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Android Link"> Android </a> </li> <li class="devsite-footer-sites-item"> <a href="//web.archive.org/web/20210518214143/https://developer.chrome.com/home" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Chrome Link"> Chrome </a> </li> <li class="devsite-footer-sites-item"> <a href="//web.archive.org/web/20210518214143/https://firebase.google.com/" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Firebase Link"> Firebase </a> </li> <li class="devsite-footer-sites-item"> <a href="//web.archive.org/web/20210518214143/https://cloud.google.com/" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Google Cloud Platform Link"> Google Cloud Platform </a> </li> <li class="devsite-footer-sites-item"> <a href="/web/20210518214143/https://developers.google.com/products" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer All products Link"> All products </a> </li> </ul> </nav> <nav class="devsite-footer-utility-links" aria-label="Utility links"> <ul class="devsite-footer-utility-list"> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="/web/20210518214143/https://developers.google.com/terms/site-terms" data-category="Site-Wide Custom Events" data-label="Footer Terms link"> Terms </a> </li> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="//web.archive.org/web/20210518214143/https://policies.google.com/privacy" data-category="Site-Wide Custom Events" data-label="Footer Privacy link"> Privacy </a> </li> <li class="devsite-footer-utility-item devsite-footer-utility-button"> <span class="devsite-footer-utility-description">Sign up for the Google Developers newsletter</span> <a class="devsite-footer-utility-link gc-analytics-event" href="//web.archive.org/web/20210518214143/https://services.google.com/fb/forms/googledevelopersnewsletter/?utm_medium=referral&utm_source=google-products&utm_team=googledevs&utm_campaign=201611-newsletter-launch" data-category="Site-Wide Custom Events" data-label="Footer Subscribe link"> Subscribe </a> </li> </ul> <devsite-language-selector> <devsite-select class="devsite-language-selector-menu"> <select aria-label="Select your language preference." class="devsite-language-selector-select" name="language" track-name="click" track-type="languageSelector"> <option>Language</option> <option value="en" lang="en" track-metadata-original-language="en" track-metadata-selected-language="en" track-name="changed" track-type="languageSelector"> English </option> <option value="id" lang="id" track-metadata-original-language="en" track-metadata-selected-language="id" track-name="changed" track-type="languageSelector"> Bahasa Indonesia </option> <option value="de" lang="de" track-metadata-original-language="en" track-metadata-selected-language="de" track-name="changed" track-type="languageSelector"> Deutsch </option> <option value="es" lang="es" track-metadata-original-language="en" track-metadata-selected-language="es" track-name="changed" track-type="languageSelector"> Español </option> <option value="fr" lang="fr" track-metadata-original-language="en" track-metadata-selected-language="fr" track-name="changed" track-type="languageSelector"> Français </option> <option value="pt_br" lang="pt_br" track-metadata-original-language="en" track-metadata-selected-language="pt_br" track-name="changed" track-type="languageSelector"> Português – Brasil </option> <option value="ru" lang="ru" track-metadata-original-language="en" track-metadata-selected-language="ru" track-name="changed" track-type="languageSelector"> Русский </option> <option value="zh_cn" lang="zh_cn" track-metadata-original-language="en" track-metadata-selected-language="zh_cn" track-name="changed" track-type="languageSelector"> 中文 – 简体 </option> <option value="ja" lang="ja" track-metadata-original-language="en" track-metadata-selected-language="ja" track-name="changed" track-type="languageSelector"> 日本語 </option> <option value="ko" lang="ko" track-metadata-original-language="en" track-metadata-selected-language="ko" track-name="changed" track-type="languageSelector"> 한국어 </option> </select> </devsite-select> </devsite-language-selector> </nav> </div> </devsite-footer-utility> </section></section> <devsite-sitemask></devsite-sitemask> <devsite-snackbar></devsite-snackbar> <devsite-tooltip></devsite-tooltip> <devsite-heading-link></devsite-heading-link> <devsite-analytics enable-analytics-iframe> <script type="application/json" analytics>[{"gaid": "UA-24532603-1", "dimensions": {"dimension6": "en", "dimension3": false, "dimension11": false, "dimension1": "Signed out", "dimension4": "YouTube Data API", "dimension5": "en", "dimension8": null}, "metrics": {"ratings_value": "metric1", "ratings_count": "metric2"}}]</script> <script type="application/json" gtm>{"parameters": {"freeTrialEligibleUser": "False", "internalUser": "False", "language": {"machineTranslated": "False", "requested": "en", "served": "en"}, "pageType": "article", "projectName": "YouTube Data API", "scriptsafe": null, "signedIn": "False", "tenant": "developers", "recommendations": {"sourcePage": "", "sourceType": 0, "sourceRank": 0, "sourceIdenticalDescriptions": 0, "sourceTitleWords": 0, "sourceDescriptionWords": 0, "experiment": ""}}}</script> </devsite-analytics> <devsite-badger></devsite-badger> <script nonce="iQ1TiUjziFNuf0lVoiD6uGVJPFMn+X"> (function(d,e,v,s,i,t,E){d['GoogleDevelopersObject']=i; t=e.createElement(v);t.async=1;t.src=s;E=e.getElementsByTagName(v)[0]; E.parentNode.insertBefore(t,E);})(window, document, 'script', 'https://web.archive.org/web/20210518214143/https://www.gstatic.com/devrel-devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/developers/js/app_loader.js', '[1,"en",null,"/js/devsite_app_module.js","https://web.archive.org/web/20210518214143/https://www.gstatic.com/devrel-devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea","https://web.archive.org/web/20210518214143/https://www.gstatic.com/devrel-devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/developers","https://web.archive.org/web/20210518214143/https://developers-dot-devsite-v2-prod.appspot.com",null,null,["/_pwa/developers/manifest.json","https://web.archive.org/web/20210518214143/https://www.gstatic.com/devrel-devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/images/video-placeholder.svg","https://web.archive.org/web/20210518214143/https://www.gstatic.com/devrel-devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/developers/images/favicon.png","https://web.archive.org/web/20210518214143/https://fonts.googleapis.com/css?family=Google+Sans:400,500|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700|Material+Icons"],1,null,[1,6,8,12,14,17,21,25,40,45,50,63,70,75,76,80,87,88,91,92,93,97,98,100,101,102,103,105,107,108,111,112,113,115,116,117,118,120,122,123,124,125,127,129,131,132,133,134,135,136],"AIzaSyAP-jjEJBzmIyKR4F-3XITp8yM9T1gEEI8","AIzaSyB6xiKGDR5O3Ak2okS4rLkauxGUG7XP0hg"]') </script> <devsite-a11y-announce></devsite-a11y-announce> </body> </html><!-- FILE ARCHIVED ON 21:41:43 May 18, 2021 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 16:27:26 Nov 28, 2024. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). --> <!-- playback timings (ms): captures_list: 0.521 exclusion.robots: 0.027 exclusion.robots.policy: 0.016 esindex: 0.01 cdx.remote: 6.04 LoadShardBlock: 164.243 (3) PetaboxLoader3.datanode: 64.597 (4) PetaboxLoader3.resolve: 111.115 (2) load_resource: 89.91 -->