[QingTing] Add new extractor

This commit is contained in:
wangchangren 2022-06-12 10:58:44 +08:00
parent 9aa8e5340f
commit 174624aef8
2 changed files with 33 additions and 0 deletions

View File

@ -975,6 +975,7 @@ from .presstv import PressTVIE
from .prosiebensat1 import ProSiebenSat1IE
from .puls4 import Puls4IE
from .pyvideo import PyvideoIE
from .qingting import QingTingIE
from .qqmusic import (
QQMusicIE,
QQMusicSingerIE,

View File

@ -0,0 +1,32 @@
# 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,
}