Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

How to get videos duration using youtube api playlistItems

$
0
0

I wanna get all videos from playlist with it's url. So, it works, but I have a problem, that youtube removed a way to get videos duration using playlistItems().list().It used to be in 'contentDetails', but now there are only 'videoId' and 'videoPublishedAt'.We can request every single video using videos().list(), but I'm afraid of the speed of this way…May be, there is a way to avoid using request to every video to get it's duration?

Sorry for my English :)You may write in any language you want.

There is a python code that I'm using for getting videos from playlist:

youtube = build("youtube", "v3", developerKey=API_KEY)def get_videos(url):    ........    collected_data = []    next_page_token = None    while True:        request = youtube.playlistItems().list(            part='snippet,contentDetails',            playlistId=playlist_id,            maxResults=50,            pageToken=next_page_token        )        response = request.execute()        collected_data.append(response)        next_page_token = response.get('nextPageToken')        if not next_page_token:            break    return collected_data[0]

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>