youtube-dl/youtube_dl/extractor/qingting.py
changren-wcr 60783025df
remove capture of patterns that aren't used
Co-authored-by: dirkf <fieldhouse@gmx.net>
2022-06-16 19:02:30 +08:00

33 lines
1.1 KiB
Python

# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class QingTingIE(InfoExtractor):
IE_NAME = 'QingTing'
_VALID_URL = r'(?:https?://)?(?:www\.)?m\.(?:qingting\.fm|qtfm\.cn)/vchannels/\d+/programs/(?P<id>\d+)'
_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)
url = re.search(r'\"audioUrl\"\s*:\s*\"(?P<url>.*?)\"', webpage).group('url')
return {
'id': video_id,
'title': title,
'ext': 'mp3',
'url': url,
}