-# coding: utf-8
-from __future__ import unicode_literals
+import itertools
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
smuggle_url,
+ str_or_none,
traverse_obj,
- unsmuggle_url,
unified_strdate,
+ unsmuggle_url,
)
-import re
-import itertools
-
class VoicyBaseIE(InfoExtractor):
def _extract_from_playlist_data(self, value):
'id': voice_id,
'title': compat_str(value.get('PlaylistName')),
'uploader': value.get('SpeakerName'),
- 'uploader_id': compat_str(value.get('SpeakerId')),
+ 'uploader_id': str_or_none(value.get('SpeakerId')),
'channel': value.get('ChannelName'),
- 'channel_id': compat_str(value.get('ChannelId')),
+ 'channel_id': str_or_none(value.get('ChannelId')),
'upload_date': upload_date,
}
'acodec': 'mp3',
'vcodec': 'none',
}]
- self._sort_formats(formats)
return {
'id': compat_str(entry.get('ArticleId')),
'title': entry.get('ArticleTitle'),
}]
def _real_extract(self, url):
- mobj = re.match(self._VALID_URL, url)
+ mobj = self._match_valid_url(url)
assert mobj
voice_id = mobj.group('id')
channel_id = mobj.group('channel_id')
@classmethod
def suitable(cls, url):
- return not VoicyIE.suitable(url) and super(VoicyChannelIE, cls).suitable(url)
+ return not VoicyIE.suitable(url) and super().suitable(url)
def _entries(self, channel_id):
pager = ''