]> jfr.im git - yt-dlp.git/commitdiff
Merge branch 'master' of https://github.com/ssaqua/youtube-dl into ssaqua-master
authorTom-Oliver Heidel <redacted>
Thu, 3 Sep 2020 02:34:56 +0000 (04:34 +0200)
committerTom-Oliver Heidel <redacted>
Thu, 3 Sep 2020 02:34:56 +0000 (04:34 +0200)
1  2 
youtube_dlc/extractor/extractors.py
youtube_dlc/extractor/pokemon.py

index 6c281ef267021c0d7f0086da5c595ad15d201993,9daf31b449a1860b874e3d93eb5650c886076687..fa5330b60e3f16c4d797d2719f549369496d59b7
@@@ -273,6 -273,7 +273,6 @@@ from .douyutv import 
      DouyuTVIE,
  )
  from .dplay import DPlayIE
 -from .dreisat import DreiSatIE
  from .drbonanza import DRBonanzaIE
  from .drtuber import DrTuberIE
  from .drtv import (
@@@ -292,7 -293,6 +292,7 @@@ from .discoverynetworks import Discover
  from .discoveryvr import DiscoveryVRIE
  from .disney import DisneyIE
  from .dispeak import DigitallySpeakingIE
 +from .doodstream import DoodStreamIE
  from .dropbox import DropboxIE
  from .dw import (
      DWIE,
@@@ -440,7 -440,6 +440,7 @@@ from .hotstar import 
  )
  from .howcast import HowcastIE
  from .howstuffworks import HowStuffWorksIE
 +from .hrfensehen import HRFernsehenIE
  from .hrti import (
      HRTiIE,
      HRTiPlaylistIE,
@@@ -805,16 -804,6 +805,16 @@@ from .orf import 
      ORFFM4IE,
      ORFFM4StoryIE,
      ORFOE1IE,
 +    ORFOE3IE,
 +    ORFNOEIE,
 +    ORFWIEIE,
 +    ORFBGLIE,
 +    ORFOOEIE,
 +    ORFSTMIE,
 +    ORFKTNIE,
 +    ORFSBGIE,
 +    ORFTIRIE,
 +    ORFVBGIE,
      ORFIPTVIE,
  )
  from .outsidetv import OutsideTVIE
@@@ -859,7 -848,10 +859,10 @@@ from .pluralsight import 
      PluralsightCourseIE,
  )
  from .podomatic import PodomaticIE
- from .pokemon import PokemonIE
+ from .pokemon import (
+     PokemonIE,
+     PokemonWatchIE,
+ )
  from .polskieradio import (
      PolskieRadioIE,
      PolskieRadioCategoryIE,
@@@ -1058,11 -1050,6 +1061,11 @@@ from .spike import 
      BellatorIE,
      ParamountNetworkIE,
  )
 +from .storyfire import (
 +    StoryFireIE,
 +    StoryFireUserIE,
 +    StoryFireSeriesIE,
 +)
  from .stitcher import StitcherIE
  from .sport5 import Sport5IE
  from .sportbox import SportBoxIE
index 80222d42831b8e58116449f96a615ea250b2985f,14ee1a72e17b3f6283c15cf3c8be8bece418e68b..14ee1a72e17b3f6283c15cf3c8be8bece418e68b
@@@ -5,8 -5,11 +5,11 @@@ import r
  
  from .common import InfoExtractor
  from ..utils import (
+     ExtractorError,
      extract_attributes,
      int_or_none,
+     js_to_json,
+     merge_dicts,
  )
  
  
@@@ -69,3 -72,67 +72,67 @@@ class PokemonIE(InfoExtractor)
              'episode_number': int_or_none(video_data.get('data-video-episode')),
              'ie_key': 'LimelightMedia',
          }
+ class PokemonWatchIE(InfoExtractor):
+     _VALID_URL = r'https?://watch\.pokemon\.com/[a-z]{2}-[a-z]{2}/player\.html\?id=(?P<id>[a-z0-9]{32})'
+     _API_URL = 'https://www.pokemon.com/api/pokemontv/v2/channels/{0:}'
+     _TESTS = [{
+         'url': 'https://watch.pokemon.com/en-us/player.html?id=8309a40969894a8e8d5bc1311e9c5667',
+         'md5': '62833938a31e61ab49ada92f524c42ff',
+         'info_dict': {
+             'id': '8309a40969894a8e8d5bc1311e9c5667',
+             'ext': 'mp4',
+             'title': 'Lillier and the Staff!',
+             'description': 'md5:338841b8c21b283d24bdc9b568849f04',
+         }
+     }, {
+         'url': 'https://watch.pokemon.com/de-de/player.html?id=b3c402e111a4459eb47e12160ab0ba07',
+         'only_matching': True
+     }]
+     def _extract_media(self, channel_array, video_id):
+         for channel in channel_array:
+             for media in channel.get('media'):
+                 if media.get('id') == video_id:
+                     return media
+         return None
+     def _real_extract(self, url):
+         video_id = self._match_id(url)
+         info = {
+             '_type': 'url',
+             'id': video_id,
+             'url': 'limelight:media:%s' % video_id,
+             'ie_key': 'LimelightMedia',
+         }
+         # API call can be avoided entirely if we are listing formats
+         if self._downloader.params.get('listformats', False):
+             return info
+         webpage = self._download_webpage(url, video_id)
+         build_vars = self._parse_json(self._search_regex(
+             r'(?s)buildVars\s*=\s*({.*?})', webpage, 'build vars'),
+             video_id, transform_source=js_to_json)
+         region = build_vars.get('region')
+         channel_array = self._download_json(self._API_URL.format(region), video_id)
+         video_data = self._extract_media(channel_array, video_id)
+         if video_data is None:
+             raise ExtractorError(
+                 'Video %s does not exist' % video_id, expected=True)
+         info['_type'] = 'url_transparent'
+         images = video_data.get('images')
+         return merge_dicts(info, {
+             'title': video_data.get('title'),
+             'description': video_data.get('description'),
+             'thumbnail': images.get('medium') or images.get('small'),
+             'series': 'Pokémon',
+             'season_number': int_or_none(video_data.get('season')),
+             'episode': video_data.get('title'),
+             'episode_number': int_or_none(video_data.get('episode')),
+         })