Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QingTing] Add new extractor #31021

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions youtube_dl/extractor/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@
from .prosiebensat1 import ProSiebenSat1IE
from .puls4 import Puls4IE
from .pyvideo import PyvideoIE
from .qingting import QingTingIE
from .qqmusic import (
QQMusicIE,
QQMusicSingerIE,
Expand Down
32 changes: 32 additions & 0 deletions youtube_dl/extractor/qingting.py
Original file line number Diff line number Diff line change
@@ -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+)'
changren-wcr marked this conversation as resolved.
Show resolved Hide resolved
_TEST = {
'url': 'https://m.qingting.fm/vchannels/378005/programs/22257411/',
changren-wcr marked this conversation as resolved.
Show resolved Hide resolved
'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')
changren-wcr marked this conversation as resolved.
Show resolved Hide resolved
webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(r'<title.*>(.*)</title>', webpage, 'title') or self._og_search_title(webpage)
changren-wcr marked this conversation as resolved.
Show resolved Hide resolved
url = re.search(r'\"audioUrl\"\s*:\s*\"(?P<url>.*?)\"', webpage).group('url')
changren-wcr marked this conversation as resolved.
Show resolved Hide resolved
return {
changren-wcr marked this conversation as resolved.
Show resolved Hide resolved
'id': video_id,
'title': title,
'ext': 'mp3',
'url': url,
}