YouTube playlist length The 2019 Stack Overflow Developer Survey Results Are InHow do I get a YouTube video thumbnail from the YouTube API?Youtube get videos and playlist accountsyoutube direct lite playlists and auto-approvalInsert video to YouTube PlaylistYouTube Playlist - Change Starting Video + Mobile SupportWatch Later playlist url via YouTube APIYouTube Data API v3 - get playlist order by latest updated timeHow to embed playlist in youtube API?Embed a youtube playlist in a webpageYoutube playlist api returns partial data

How are circuits which use complex ICs normally simulated?

Realistic Alternatives to Dust: What Else Could Feed a Plankton Bloom?

JSON.serialize: is it possible to suppress null values of a map?

Is three citations per paragraph excessive for undergraduate research paper?

How do you say "canon" as in "official for a story universe"?

Dual Citizen. Exited the US on Italian passport recently

Limit the amount of RAM Mathematica may access?

Spanish for "widget"

How to create dashed lines/arrows in Illustrator

Why is my p-value correlated to difference between means in two sample tests?

Does light intensity oscillate really fast since it is a wave?

Are USB sockets on wall outlets live all the time, even when the switch is off?

The difference between dialogue marks

Extreme, unacceptable situation and I can't attend work tomorrow morning

Why can Shazam do this?

What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?

Potential by Assembling Charges

Why did Howard Stark use all the Vibranium they had on a prototype shield?

Can the Protection from Evil and Good spell be used on the caster?

Could JWST stay at L2 "forever"?

Inversion Puzzle

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

Does it makes sense to buy a new cycle to learn riding?

In microwave frequencies, do you use a circulator when you need a (near) perfect diode?



YouTube playlist length



The 2019 Stack Overflow Developer Survey Results Are InHow do I get a YouTube video thumbnail from the YouTube API?Youtube get videos and playlist accountsyoutube direct lite playlists and auto-approvalInsert video to YouTube PlaylistYouTube Playlist - Change Starting Video + Mobile SupportWatch Later playlist url via YouTube APIYouTube Data API v3 - get playlist order by latest updated timeHow to embed playlist in youtube API?Embed a youtube playlist in a webpageYoutube playlist api returns partial data



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















I would like to know if there's a way to get the number of total videos in a playlist.



I'm building a Python script that need to get the number of videos to do a for loop. Or, if getting this information isn't possible, can you give me a way to do it without a for loop?










share|improve this question






























    2















    I would like to know if there's a way to get the number of total videos in a playlist.



    I'm building a Python script that need to get the number of videos to do a for loop. Or, if getting this information isn't possible, can you give me a way to do it without a for loop?










    share|improve this question


























      2












      2








      2








      I would like to know if there's a way to get the number of total videos in a playlist.



      I'm building a Python script that need to get the number of videos to do a for loop. Or, if getting this information isn't possible, can you give me a way to do it without a for loop?










      share|improve this question
















      I would like to know if there's a way to get the number of total videos in a playlist.



      I'm building a Python script that need to get the number of videos to do a for loop. Or, if getting this information isn't possible, can you give me a way to do it without a for loop?







      youtube youtube-api






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 1 '15 at 1:13









      Bond

      14.2k62249




      14.2k62249










      asked Aug 1 '15 at 1:11









      mgulmgul

      394523




      394523






















          2 Answers
          2






          active

          oldest

          votes


















          8














          You can use the following request



          https://www.googleapis.com/youtube/v3/playlistItems?part=id&maxResults=0&playlistId=PLAYLIST_ID&key=YOUR_API_KEY


          Look for 'totalResults' in the response, which will give you a total number of videos in the playlist






          share|improve this answer






























            1














            Here's another way, using Python and not constructing a URL string from scratch:



            With the Python API for listing out playlistItems (assuming you're looking for publicly available playlists only), you build a resource object to interact with the API, and then query the result for your playlistId of choice:



            client = build('youtube', 'v3', developerKey=<your_api_key>)
            res = client.playlistItems().list(playlistId=<your_playlist_id>, part='snippet').execute()
            length_of_playlist = res['pageInfo']['totalResults']





            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31757249%2fyoutube-playlist-length%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              8














              You can use the following request



              https://www.googleapis.com/youtube/v3/playlistItems?part=id&maxResults=0&playlistId=PLAYLIST_ID&key=YOUR_API_KEY


              Look for 'totalResults' in the response, which will give you a total number of videos in the playlist






              share|improve this answer



























                8














                You can use the following request



                https://www.googleapis.com/youtube/v3/playlistItems?part=id&maxResults=0&playlistId=PLAYLIST_ID&key=YOUR_API_KEY


                Look for 'totalResults' in the response, which will give you a total number of videos in the playlist






                share|improve this answer

























                  8












                  8








                  8







                  You can use the following request



                  https://www.googleapis.com/youtube/v3/playlistItems?part=id&maxResults=0&playlistId=PLAYLIST_ID&key=YOUR_API_KEY


                  Look for 'totalResults' in the response, which will give you a total number of videos in the playlist






                  share|improve this answer













                  You can use the following request



                  https://www.googleapis.com/youtube/v3/playlistItems?part=id&maxResults=0&playlistId=PLAYLIST_ID&key=YOUR_API_KEY


                  Look for 'totalResults' in the response, which will give you a total number of videos in the playlist







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 1 '15 at 7:38









                  Saumini NavaratnamSaumini Navaratnam

                  4,99511746




                  4,99511746























                      1














                      Here's another way, using Python and not constructing a URL string from scratch:



                      With the Python API for listing out playlistItems (assuming you're looking for publicly available playlists only), you build a resource object to interact with the API, and then query the result for your playlistId of choice:



                      client = build('youtube', 'v3', developerKey=<your_api_key>)
                      res = client.playlistItems().list(playlistId=<your_playlist_id>, part='snippet').execute()
                      length_of_playlist = res['pageInfo']['totalResults']





                      share|improve this answer



























                        1














                        Here's another way, using Python and not constructing a URL string from scratch:



                        With the Python API for listing out playlistItems (assuming you're looking for publicly available playlists only), you build a resource object to interact with the API, and then query the result for your playlistId of choice:



                        client = build('youtube', 'v3', developerKey=<your_api_key>)
                        res = client.playlistItems().list(playlistId=<your_playlist_id>, part='snippet').execute()
                        length_of_playlist = res['pageInfo']['totalResults']





                        share|improve this answer

























                          1












                          1








                          1







                          Here's another way, using Python and not constructing a URL string from scratch:



                          With the Python API for listing out playlistItems (assuming you're looking for publicly available playlists only), you build a resource object to interact with the API, and then query the result for your playlistId of choice:



                          client = build('youtube', 'v3', developerKey=<your_api_key>)
                          res = client.playlistItems().list(playlistId=<your_playlist_id>, part='snippet').execute()
                          length_of_playlist = res['pageInfo']['totalResults']





                          share|improve this answer













                          Here's another way, using Python and not constructing a URL string from scratch:



                          With the Python API for listing out playlistItems (assuming you're looking for publicly available playlists only), you build a resource object to interact with the API, and then query the result for your playlistId of choice:



                          client = build('youtube', 'v3', developerKey=<your_api_key>)
                          res = client.playlistItems().list(playlistId=<your_playlist_id>, part='snippet').execute()
                          length_of_playlist = res['pageInfo']['totalResults']






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 22 at 2:45









                          Victor VulovicVictor Vulovic

                          10819




                          10819



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31757249%2fyoutube-playlist-length%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                              Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                              Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript