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;
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
add a comment |
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
add a comment |
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
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
youtube youtube-api
edited Aug 1 '15 at 1:13
Bond
14.2k62249
14.2k62249
asked Aug 1 '15 at 1:11
mgulmgul
394523
394523
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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
add a comment |
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']
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
answered Aug 1 '15 at 7:38
Saumini NavaratnamSaumini Navaratnam
4,99511746
4,99511746
add a comment |
add a comment |
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']
add a comment |
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']
add a comment |
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']
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']
answered Mar 22 at 2:45
Victor VulovicVictor Vulovic
10819
10819
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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