示例#1
0
def update_user_infos(user, service):
    videos = get_user_videos(service)
    videos = [x for x in videos]
    store_user_videos(user, videos)

    ids = [x for (x, _) in videos]
    ids = list(set(ids))
    num = MAX_RESULTS
    partition = [ids[i * num:(i + 1) * num] for i in range(len(ids) / num + 1)]
    video_details = []
    for p in partition:
        id_str = ','.join(p)
        if id_str:
            res = service.videos().list(part='snippet,statistics',
                                        id=id_str,
                                        maxResults=num).execute()
            video_details.extend(res.get('items', []))

    store_videos(video_details)
示例#2
0
def update_user_infos(user, service):
    videos = get_user_videos(service)
    videos = [x for x in videos]
    store_user_videos(user, videos)

    ids = [x for (x, _) in videos]
    ids = list(set(ids))
    num = MAX_RESULTS
    partition = [ids[i * num: (i + 1) * num] for i in range(len(ids) / num + 1)]
    video_details = []
    for p in partition:
        id_str = ','.join(p)
        if id_str:
            res = service.videos().list(
                part='snippet,statistics',
                id=id_str,
                maxResults=num
            ).execute()
            video_details.extend(res.get('items', []))

    store_videos(video_details)
示例#3
0
def crawl_video():
    res = get_video_detail()
    store_videos(res)
示例#4
0
def crawl_video():
    res = get_video_detail()
    store_videos(res)