From 29c6726646326fdbf17fca2f0e5600b6ee3b9f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Sat, 8 Apr 2017 21:11:08 +0700 Subject: [PATCH] [mixcloud] Fix view count extraction and modernize --- youtube_dl/extractor/mixcloud.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/mixcloud.py b/youtube_dl/extractor/mixcloud.py index bc38a8663..0efbe660a 100644 --- a/youtube_dl/extractor/mixcloud.py +++ b/youtube_dl/extractor/mixcloud.py @@ -97,7 +97,7 @@ class MixcloudIE(InfoExtractor): view_count = str_to_int(self._search_regex( [r'([0-9,.]+)', - r'm-tooltip=["\']([\d,.]+) plays'], + r'(?:m|data)-tooltip=["\']([\d,.]+) plays'], webpage, 'play count', default=None)) return { @@ -143,7 +143,7 @@ class MixcloudPlaylistBaseIE(InfoExtractor): class MixcloudUserIE(MixcloudPlaylistBaseIE): - _VALID_URL = r'^(?:https?://)?(?:www\.)?mixcloud\.com/(?P[^/]+)/(?Puploads|favorites|listens)?/?$' + _VALID_URL = r'https?://(?:www\.)?mixcloud\.com/(?P[^/]+)/(?Puploads|favorites|listens)?/?$' IE_NAME = 'mixcloud:user' _TESTS = [{ @@ -216,7 +216,7 @@ class MixcloudUserIE(MixcloudPlaylistBaseIE): class MixcloudPlaylistIE(MixcloudPlaylistBaseIE): - _VALID_URL = r'^(?:https?://)?(?:www\.)?mixcloud\.com/(?P[^/]+)/playlists/(?P[^/]+)/?$' + _VALID_URL = r'https?://(?:www\.)?mixcloud\.com/(?P[^/]+)/playlists/(?P[^/]+)/?$' IE_NAME = 'mixcloud:playlist' _TESTS = [{ @@ -259,7 +259,7 @@ class MixcloudPlaylistIE(MixcloudPlaylistBaseIE): class MixcloudStreamIE(MixcloudPlaylistBaseIE): - _VALID_URL = r'^(?:https?://)?(?:www\.)?mixcloud\.com/(?P[^/]+)/stream/?$' + _VALID_URL = r'https?://(?:www\.)?mixcloud\.com/(?P[^/]+)/stream/?$' IE_NAME = 'mixcloud:stream' _TEST = {