Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Backups
youtube-dl
Commits
af322eb8
Unverified
Commit
af322eb8
authored
Aug 04, 2018
by
Sergey M․
Browse files
[funk:channel] Improve byChannelAlias extraction (closes #17142)
parent
cb1c3a3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
youtube_dl/extractor/funk.py
youtube_dl/extractor/funk.py
+23
-8
No files found.
youtube_dl/extractor/funk.py
View file @
af322eb8
# coding: utf-8
# coding: utf-8
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
itertools
import
re
import
re
from
.common
import
InfoExtractor
from
.common
import
InfoExtractor
...
@@ -125,17 +126,31 @@ class FunkChannelIE(FunkBaseIE):
...
@@ -125,17 +126,31 @@ class FunkChannelIE(FunkBaseIE):
# Id-based channels are currently broken on their side: webplayer
# Id-based channels are currently broken on their side: webplayer
# tries to process them via byChannelAlias endpoint and fails
# tries to process them via byChannelAlias endpoint and fails
# predictably.
# predictably.
by_channel_alias
=
self
.
_download_json
(
for
page_num
in
itertools
.
count
():
'https://www.funk.net/api/v3.1/webapp/videos/byChannelAlias/%s'
by_channel_alias
=
self
.
_download_json
(
%
channel_id
,
'https://www.funk.net/api/v3.1/webapp/videos/byChannelAlias/%s'
'Downloading byChannelAlias JSON'
,
headers
=
headers
,
query
=
{
%
channel_id
,
'size'
:
100
,
'Downloading byChannelAlias JSON page %d'
%
(
page_num
+
1
),
},
fatal
=
False
)
headers
=
headers
,
query
=
{
if
by_channel_alias
:
'filterFsk'
:
'false'
,
'sort'
:
'creationDate,desc'
,
'size'
:
100
,
'page'
:
page_num
,
},
fatal
=
False
)
if
not
by_channel_alias
:
break
video_list
=
try_get
(
video_list
=
try_get
(
by_channel_alias
,
lambda
x
:
x
[
'_embedded'
][
'videoList'
],
list
)
by_channel_alias
,
lambda
x
:
x
[
'_embedded'
][
'videoList'
],
list
)
if
video_list
:
if
not
video_list
:
break
try
:
video
=
next
(
r
for
r
in
video_list
if
r
.
get
(
'alias'
)
==
alias
)
video
=
next
(
r
for
r
in
video_list
if
r
.
get
(
'alias'
)
==
alias
)
break
except
StopIteration
:
pass
if
not
try_get
(
by_channel_alias
,
lambda
x
:
x
[
'_links'
][
'next'
]):
break
if
not
video
:
if
not
video
:
by_id_list
=
self
.
_download_json
(
by_id_list
=
self
.
_download_json
(
...
...
Write
Preview
Markdown
is supported
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