aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchangren-wcr <105254603+changren-wcr@users.noreply.github.com>2022-11-07 02:11:53 +0800
committerGitHub <noreply@github.com>2022-11-06 23:41:53 +0530
commitc94df4d19d3af4120c9b674556acb1f1905c366f (patch)
treee2067015a959f41f2edecba4640072a45182c3c0
parent728f4b5c2ef914f3b45d160883469502366d8eac (diff)
downloadhypervideo-pre-c94df4d19d3af4120c9b674556acb1f1905c366f.tar.lz
hypervideo-pre-c94df4d19d3af4120c9b674556acb1f1905c366f.tar.xz
hypervideo-pre-c94df4d19d3af4120c9b674556acb1f1905c366f.zip
[extractor/qingting] Add extractor (#5329)
Closes #5323 Authored by: changren-wcr, bashonly
-rw-r--r--yt_dlp/extractor/_extractors.py1
-rw-r--r--yt_dlp/extractor/qingting.py47
2 files changed, 48 insertions, 0 deletions
diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py
index d434a5460..1960692ef 100644
--- a/yt_dlp/extractor/_extractors.py
+++ b/yt_dlp/extractor/_extractors.py
@@ -1431,6 +1431,7 @@ from .prx import (
)
from .puls4 import Puls4IE
from .pyvideo import PyvideoIE
+from .qingting import QingTingIE
from .qqmusic import (
QQMusicIE,
QQMusicSingerIE,
diff --git a/yt_dlp/extractor/qingting.py b/yt_dlp/extractor/qingting.py
new file mode 100644
index 000000000..aa690d492
--- /dev/null
+++ b/yt_dlp/extractor/qingting.py
@@ -0,0 +1,47 @@
+from .common import InfoExtractor
+
+from ..utils import traverse_obj
+
+
+class QingTingIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.|m\.)?(?:qingting\.fm|qtfm\.cn)/v?channels/(?P<channel>\d+)/programs/(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://www.qingting.fm/channels/378005/programs/22257411/',
+ 'md5': '47e6a94f4e621ed832c316fd1888fb3c',
+ 'info_dict': {
+ 'id': '22257411',
+ 'title': '用了十年才修改,谁在乎教科书?',
+ 'channel_id': '378005',
+ 'channel': '睡前消息',
+ 'uploader': '马督工',
+ 'ext': 'm4a',
+ }
+ }, {
+ 'url': 'https://m.qtfm.cn/vchannels/378005/programs/23023573/',
+ 'md5': '2703120b6abe63b5fa90b975a58f4c0e',
+ 'info_dict': {
+ 'id': '23023573',
+ 'title': '【睡前消息488】重庆山火之后,有图≠真相',
+ 'channel_id': '378005',
+ 'channel': '睡前消息',
+ 'uploader': '马督工',
+ 'ext': 'm4a',
+ }
+ }]
+
+ def _real_extract(self, url):
+ channel_id, pid = self._match_valid_url(url).group('channel', 'id')
+ webpage = self._download_webpage(
+ f'https://m.qtfm.cn/vchannels/{channel_id}/programs/{pid}/', pid)
+ info = self._search_json(r'window\.__initStores\s*=', webpage, 'program info', pid)
+ return {
+ 'id': pid,
+ 'title': traverse_obj(info, ('ProgramStore', 'programInfo', 'title')),
+ 'channel_id': channel_id,
+ 'channel': traverse_obj(info, ('ProgramStore', 'channelInfo', 'title')),
+ 'uploader': traverse_obj(info, ('ProgramStore', 'podcasterInfo', 'podcaster', 'nickname')),
+ 'url': traverse_obj(info, ('ProgramStore', 'programInfo', 'audioUrl')),
+ 'vcodec': 'none',
+ 'acodec': 'm4a',
+ 'ext': 'm4a',
+ }