Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get all youtube playlist videos as json without api python

import urllib, json
author = 'Youtube_Username'

foundAll = False
ind = 1
videos = []
while not foundAll:
    inp = urllib.urlopen(r'http://gdata.youtube.com/feeds/api/videos?start-index={0}&max-results=50&alt=json&orderby=published&author={1}'.format( ind, author ) )
    try:
        resp = json.load(inp)
        inp.close()
        returnedVideos = resp['feed']['entry']
        for video in returnedVideos:
            videos.append( video ) 

        ind += 50
        print len( videos )
        if ( len( returnedVideos ) < 50 ):
            foundAll = True
    except:
        #catch the case where the number of videos in the channel is a multiple of 50
        print "error"
        foundAll = True

for video in videos:
    print video['title'] # video title
    print video['link'][0]['href'] #url
Comment

PREVIOUS NEXT
Code Example
Javascript :: object property with space 
Javascript :: how to insert keycode in switch statement in javascript 
Javascript :: json report plugin 
Javascript :: amelia earheart 
Javascript :: getx remove all previous routes 
Javascript :: how to use muliple calsse in miltiple file java script 
Javascript :: setstate to false after 10 sec react native 
Javascript :: Getting data from one axios to another in componentDidMount 
Javascript :: ${product} meaning in react js 
Javascript :: 5.2.1. Loose Equality With ==¶ 
Javascript :: how to create a mixed array in javascript 
Javascript :: Tims first jsom 
Javascript :: get nested value on object react using dot 
Javascript :: 8.1.1. Declaring an Array¶ 
Javascript :: three js div over orbitcontrol 
Javascript :: Shorthand for calling functions conditionally 
Javascript :: log errors react 
Javascript :: faker link for json post req 
Javascript :: pipefy deleteCard 
Javascript :: how to pass custom parameter onchage 
Javascript :: javascript array group duplicates 
Javascript :: javascript fix errora 
Javascript :: Grunt--project configuration object--uglify 
Javascript :: uselazyquery refetch from child 
Javascript :: the caller does not have permission firestore 
Javascript :: js get word before question mark 
Javascript :: Entendendo Package Json e instalando o Express 
Javascript :: add if condition in map react 
Javascript :: send keypress from iframe to parent 
Javascript :: swapping java primitives values 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =