aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2018-04-27 03:45:52 +0700
committerSergey M․ <dstftw@gmail.com>2018-04-27 03:45:52 +0700
commitc84eae4f66be8a22c14b852bdb01773bb3807239 (patch)
tree4620eb893dab1ee95700c17b3a8a4bdc73e67110 /youtube_dl
parentd3711b00502d9104a3697aba5d210a25066ca756 (diff)
[funk:channel] Improve extraction (closes #16285)
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/funk.py51
1 files changed, 40 insertions, 11 deletions
diff --git a/youtube_dl/extractor/funk.py b/youtube_dl/extractor/funk.py
index faea6576f..0ff058619 100644
--- a/youtube_dl/extractor/funk.py
+++ b/youtube_dl/extractor/funk.py
@@ -5,7 +5,10 @@ import re
from .common import InfoExtractor
from .nexx import NexxIE
-from ..utils import int_or_none
+from ..utils import (
+ int_or_none,
+ try_get,
+)
class FunkBaseIE(InfoExtractor):
@@ -78,6 +81,20 @@ class FunkChannelIE(FunkBaseIE):
'skip_download': True,
},
}, {
+ # only available via byIdList API
+ 'url': 'https://www.funk.net/channel/informr/martin-sonneborn-erklaert-die-eu',
+ 'info_dict': {
+ 'id': '205067',
+ 'ext': 'mp4',
+ 'title': 'Martin Sonneborn erklärt die EU',
+ 'description': 'md5:050f74626e4ed87edf4626d2024210c0',
+ 'timestamp': 1494424042,
+ 'upload_date': '20170510',
+ },
+ 'params': {
+ 'skip_download': True,
+ },
+ }, {
'url': 'https://www.funk.net/channel/59d5149841dca100012511e3/mein-erster-job-lovemilla-folge-1/lovemilla/',
'only_matching': True,
}]
@@ -87,16 +104,28 @@ class FunkChannelIE(FunkBaseIE):
channel_id = mobj.group('id')
alias = mobj.group('alias')
- results = self._download_json(
- 'https://www.funk.net/api/v3.0/content/videos/filter', channel_id,
- headers={
- 'authorization': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnROYW1lIjoiY3VyYXRpb24tdG9vbCIsInNjb3BlIjoic3RhdGljLWNvbnRlbnQtYXBpLGN1cmF0aW9uLWFwaSxzZWFyY2gtYXBpIn0.q4Y2xZG8PFHai24-4Pjx2gym9RmJejtmK6lMXP5wAgc',
- 'Referer': url,
- }, query={
- 'channelId': channel_id,
- 'size': 100,
- })['result']
+ headers = {
+ 'authorization': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnROYW1lIjoiY3VyYXRpb24tdG9vbCIsInNjb3BlIjoic3RhdGljLWNvbnRlbnQtYXBpLGN1cmF0aW9uLWFwaSxzZWFyY2gtYXBpIn0.q4Y2xZG8PFHai24-4Pjx2gym9RmJejtmK6lMXP5wAgc',
+ 'Referer': url,
+ }
- video = next(r for r in results if r.get('alias') == alias)
+ video = None
+
+ by_id_list = self._download_json(
+ 'https://www.funk.net/api/v3.0/content/videos/byIdList', channel_id,
+ headers=headers, query={
+ 'ids': alias,
+ }, fatal=False)
+ if by_id_list:
+ video = try_get(by_id_list, lambda x: x['result'][0], dict)
+
+ if not video:
+ results = self._download_json(
+ 'https://www.funk.net/api/v3.0/content/videos/filter', channel_id,
+ headers=headers, query={
+ 'channelId': channel_id,
+ 'size': 100,
+ })['result']
+ video = next(r for r in results if r.get('alias') == alias)
return self._make_url_result(video)