diff options
| author | Lesmiscore (Naoya Ozaki) <nao20010128@gmail.com> | 2022-03-10 22:24:50 +0900 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-10 22:24:50 +0900 | 
| commit | 24e3d87431855fd30ecf738ed7ddc6d89c6b5ef9 (patch) | |
| tree | 12af20d645a4b83da77946572c1d4d0f843bbfa6 | |
| parent | 63b2f88bc77f3fa8388f2ec329f270672d4430b1 (diff) | |
| download | hypervideo-pre-24e3d87431855fd30ecf738ed7ddc6d89c6b5ef9.tar.lz hypervideo-pre-24e3d87431855fd30ecf738ed7ddc6d89c6b5ef9.tar.xz hypervideo-pre-24e3d87431855fd30ecf738ed7ddc6d89c6b5ef9.zip | |
[PokemonSoundLibrary] Add extractor (#3001)
Authored by: Lesmiscore
| -rw-r--r-- | yt_dlp/extractor/extractors.py | 1 | ||||
| -rw-r--r-- | yt_dlp/extractor/pokemon.py | 40 | 
2 files changed, 41 insertions, 0 deletions
| diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py index 1b7bbf989..09b795c56 100644 --- a/yt_dlp/extractor/extractors.py +++ b/yt_dlp/extractor/extractors.py @@ -1225,6 +1225,7 @@ from .podomatic import PodomaticIE  from .pokemon import (      PokemonIE,      PokemonWatchIE, +    PokemonSoundLibraryIE,  )  from .pokergo import (      PokerGoIE, diff --git a/yt_dlp/extractor/pokemon.py b/yt_dlp/extractor/pokemon.py index 402b574a7..b411390e2 100644 --- a/yt_dlp/extractor/pokemon.py +++ b/yt_dlp/extractor/pokemon.py @@ -1,6 +1,7 @@  # coding: utf-8  from __future__ import unicode_literals +import re  from .common import InfoExtractor  from ..utils import ( @@ -138,3 +139,42 @@ class PokemonWatchIE(InfoExtractor):              'episode': video_data.get('title'),              'episode_number': int_or_none(video_data.get('episode')),          }) + + +class PokemonSoundLibraryIE(InfoExtractor): +    _VALID_URL = r'https?://soundlibrary\.pokemon\.co\.jp' + +    _TESTS = [{ +        'url': 'https://soundlibrary.pokemon.co.jp/', +        'info_dict': { +            'title': 'Pokémon Diamond and Pearl Sound Tracks', +        }, +        'playlist_mincount': 149, +    }] + +    def _real_extract(self, url): +        musicbox_webpage = self._download_webpage( +            'https://soundlibrary.pokemon.co.jp/musicbox', None, +            'Downloading list of songs') +        song_titles = [x.group(1) for x in re.finditer(r'<span>([^>]+?)</span><br/>をてもち曲に加えます。', musicbox_webpage)] +        song_titles = song_titles[4::2] + +        # each songs don't have permalink; instead we return all songs at once +        song_entries = [{ +            'id': f'pokemon-soundlibrary-{song_id}', +            'url': f'https://soundlibrary.pokemon.co.jp/api/assets/signing/sounds/wav/{song_id}.wav', +            # note: the server always serves MP3 files, despite its extension of the URL above +            'ext': 'mp3', +            'acodec': 'mp3', +            'vcodec': 'none', +            'title': song_title, +            'track': song_title, +            'artist': 'Nintendo / Creatures Inc. / GAME FREAK inc.', +            'uploader': 'Pokémon', +            'release_year': 2006, +            'release_date': '20060928', +            'track_number': song_id, +            'album': 'Pokémon Diamond and Pearl', +        } for song_id, song_title in enumerate(song_titles, 1)] + +        return self.playlist_result(song_entries, playlist_title='Pokémon Diamond and Pearl Sound Tracks') | 
