Commit 1d28c82f authored by Mikuláš Poul's avatar Mikuláš Poul
Browse files

Fixed retrieving deleted videos

parent b1fe02c4
Pipeline #56650591 passed with stages
in 7 minutes and 6 seconds
......@@ -5,3 +5,4 @@ exclude =
00*.py, # migrations
ignore =
F401
W504
# encoding=utf-8
import json
import dateutil.parser
import requests
import logging
from datetime import date
from collections import namedtuple
from datetime import date
import dateutil.parser
import isodate
import requests
from django.conf import settings
from django.db.models import F
import isodate
from apps import redis, client
from apps.core.models import Counter
......@@ -189,12 +189,19 @@ def load_extra_data(ids):
for video_data in data['items']:
snippet = video_data['snippet']
if (snippet["title"] == "Deleted video" and
snippet["description"] == "This video is unavailable." and
"contentDetails" not in video_data):
continue
data = {
"description": video_data['snippet']['description'],
"thumbnail": parse_thumbnail(video_data['snippet']['thumbnails']),
"description": snippet['description'],
"thumbnail": parse_thumbnail(snippet['thumbnails']),
"quality": video_data['contentDetails']['definition'].upper(),
"captions": parse_captions(video_data['contentDetails']['caption']),
"title": video_data['snippet']['title'],
"title": snippet['title'],
"duration": parse_duration(video_data['contentDetails']['duration'])
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment