1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2025-02-06 18:20:02 +00:00

[weeklybeats] Add new extractor weeklybeats

This commit is contained in:
Cloud Chagnon 2018-01-11 23:13:55 -07:00
parent 609850acfb
commit dd64d69b7b
2 changed files with 37 additions and 1 deletions

View File

@ -1299,8 +1299,9 @@ from .webofstories import (
WebOfStoriesIE, WebOfStoriesIE,
WebOfStoriesPlaylistIE, WebOfStoriesPlaylistIE,
) )
from .weeklybeats import WeeklyBeatsIE
from .weibo import ( from .weibo import (
WeiboIE, WeiboIE,
WeiboMobileIE WeiboMobileIE
) )
from .weiqitv import WeiqiTVIE from .weiqitv import WeiqiTVIE

View File

@ -0,0 +1,35 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class WeeklyBeatsIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?weeklybeats\.com/(.+)/music/(.+)'
_TEST = {
'url': 'https://weeklybeats.com/pulsn/music/week-1-bass-drop',
'md5': '03465d0fa355147822d2ba1100a82c7c',
'info_dict': {
'id': 'week-1-bass-drop',
'ext': 'mp3',
'title': 'Week 1: Bass Drip ',
'url': 'https://weeklybeats.s3.amazonaws.com/music/2012/pulsn_weeklybeats-2012_1_week-1-bass-drop.mp3',
'uploader': 'pulsn',
'description': 'A blend of IDM noises mixed with Berlin styled arps and ambient pads.'
}
}
def _real_extract(self, url):
video_id = self._search_regex(r'https://weeklybeats.com/[^/]+/music/([^/]*)/?', url, 'video_id')
print(video_id)
webpage = self._download_webpage(url, video_id)
# TODO more code goes here, for example ...
return {
'id': video_id,
'title': self._search_regex(r'<meta[^>]+property="og:title"[^>]+content="([^\"]+)"[^>]*>', webpage, 'title', fatal=False),
'description': self._search_regex(r'<meta[^>]+property="og:description"[^>]+content="([^\"]*)"[^>]*>', webpage, 'description', fatal=False),
'uploader': self._search_regex(r'<a[^>]+class="form_popular_tags ?artist"[^>]*>View by:([^<]+)<', webpage, 'uploader', fatal=False),
'url': self._search_regex(r'mp3: \'([^\']+)\'', webpage, 'url')
# TODO more properties (see youtube_dl/extractor/common.py)
}