예제 #1
0
def getTagsForListOfVideoIds(youtube, videoIds):
    videoTagData = {}

    for chunk in GeneralUtil.chunkList(videoIds, 50):
        idString = ""

        for videoId in chunk:
            idString += videoId + ','

        idString = idString[:-1]

        request = youtube.videos().list(
            part="snippet,topicDetails",
            id=idString
        )
        response = request.execute()
        
        for video in response['items']:
            tagData = {}
            
            if('tags' in video['snippet']):
                tagData['tags'] = video['snippet']['tags']
            if('topicDetails' in video):
                tagData['topicDetails'] = video['topicDetails']

            videoTagData[video['snippet']['title']] = tagData


    return videoTagData
예제 #2
0
def getChannelData(youtube, channelIds, part):

    channelMap = {}

    for chunk in GeneralUtil.chunkList(channelIds, 50):
        idString = ""
        for id in chunk:
            idString += id + ","

        idString = idString[:-1]
        request = youtube.channels().list(part=part, id=idString)

        response = request.execute()

        for item in response['items']:
            channelMap[item['id']] = item

    return channelMap
예제 #3
0
def getChannelTopics(youtube, channelIds):

    channelTopicMap = {}

    for chunk in GeneralUtil.chunkList(channelIds, 50):
        idString = ""
        for id in chunk:
            idString += id + ","

        idString = idString[:-1]
        request = youtube.channels().list(
            part="snippet,topicDetails",
            id=idString
        )

        response = request.execute()

        for item in response['items']:
            channelTopicMap[item['snippet']['title']] = item['topicDetails']['topicCategories']

    return channelTopicMap