Exemplo n.º 1
0
def refresh_online_stats():
    for vid in Video.objects.all():
        yt_entry = get_youtube_entry(vid.youtubeID)
        if yt_entry:
            online_stats = get_online_stats(yt_entry)
            vid.onlineViews = online_stats['views']
            vid.onlineLikes = int(online_stats['likes']) + VideoLike.objects.filter(video=vid.uid).count()
            vid.save()
Exemplo n.º 2
0
def refresh_online_stats():
    url = 'https://www.googleapis.com/youtube/v3/videos?part=statistics&id='
    for vid in Video.objects.all():
        yt_entry = get_youtube_entry(vid.youtubeID, url)
        if yt_entry:
            online_stats = get_online_stats(yt_entry)
            vid.onlineViews = online_stats['views']
            vid.onlineLikes = int(online_stats['likes']) + VideoLike.objects.filter(video=vid.uid).count()
            vid.save()
Exemplo n.º 3
0
def refresh_online_stats():
    for vid in Video.objects.all():
        yt_entry = get_youtube_entry(vid.youtubeID)
        if yt_entry:
            online_stats = get_online_stats(yt_entry)
            vid.onlineViews = online_stats['views']
            vid.onlineLikes = int(
                online_stats['likes']) + VideoLike.objects.filter(
                    video=vid.uid).count()
            vid.save()