2022-06-12 11:58:44 +09:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
|
|
|
|
|
|
|
|
class QingTingIE(InfoExtractor):
|
|
|
|
IE_NAME = 'QingTing'
|
2022-06-16 20:02:30 +09:00
|
|
|
_VALID_URL = r'(?:https?://)?(?:www\.)?m\.(?:qingting\.fm|qtfm\.cn)/vchannels/\d+/programs/(?P<id>\d+)'
|
2022-06-12 11:58:44 +09:00
|
|
|
_TEST = {
|
|
|
|
'url': 'https://m.qingting.fm/vchannels/378005/programs/22257411/',
|
|
|
|
'md5': '47e6a94f4e621ed832c316fd1888fb3c',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '22257411',
|
|
|
|
'ext': 'mp3',
|
|
|
|
'title': '用了十年才修改,谁在乎教科书?-睡前消息-蜻蜓FM听头条',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = re.search(self._VALID_URL, url).group('id')
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
title = self._html_search_regex(r'<title.*>(.*)</title>', webpage, 'title') or self._og_search_title(webpage)
|
2022-06-16 20:08:09 +09:00
|
|
|
url = self._search_regex(
|
|
|
|
r'''("|')audioUrl\1\s*:\s*("|')(?P<url>(?:(?!\2).)*)\2''',
|
|
|
|
webpage, 'audio URL')
|
|
|
|
test_url = url_or_none(url)
|
|
|
|
if not test_url:
|
|
|
|
raise ExtractorError('Invalid audio URL %s' % (url, ))
|
|
|
|
url = test_url
|
2022-06-12 11:58:44 +09:00
|
|
|
return {
|
|
|
|
'id': video_id,
|
|
|
|
'title': title,
|
|
|
|
'ext': 'mp3',
|
|
|
|
'url': url,
|
|
|
|
}
|