Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Menu
Projects
Groups
Snippets
Get a free trial
Sign up
Login
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mikuláš Poul
BetterSubBox
Commits
1d28c82f
Commit
1d28c82f
authored
Apr 13, 2019
by
Mikuláš Poul
Browse files
Fixed retrieving deleted videos
parent
b1fe02c4
Pipeline
#56650591
passed with stages
in 7 minutes and 6 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
.flake8
View file @
1d28c82f
...
...
@@ -5,3 +5,4 @@ exclude =
00*.py, # migrations
ignore =
F401
W504
apps/youtube/utils.py
View file @
1d28c82f
# 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'
])
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment