From 189186a9a6781cc907ff883cd8487a92c36a5535 Mon Sep 17 00:00:00 2001 From: hatienl0i261299 Date: Sat, 28 Mar 2020 18:11:57 +0700 Subject: [PATCH] [zingmp3_vn] Add new extractor --- youtube_dl/extractor/zingmp3_vn.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/zingmp3_vn.py b/youtube_dl/extractor/zingmp3_vn.py index 0258be522..657e4ab90 100644 --- a/youtube_dl/extractor/zingmp3_vn.py +++ b/youtube_dl/extractor/zingmp3_vn.py @@ -108,13 +108,17 @@ class Zingmp3_vnIE(InfoExtractor): _default_host = "https://zingmp3.vn/" def _real_extract(self, url): - + self.convert_oldDomain_to_newDomain(url) mobj = re.search(self._VALID_URL, url) video_id = mobj.group('id') type = mobj.group('type') slug = mobj.group('slug') return self.extract_info_media(type, slug, video_id) + def convert_oldDomain_to_newDomain(self,url): + if 'mp3.zing.vn' in url: + url = url.replace('mp3.zing.vn','zingmp3.vn') + return url def extract_info_media(self, type, slug, video_id): formats = [] name_api = '' @@ -412,6 +416,7 @@ class Zingmp3_vnPlaylistIE(Zingmp3_vnIE): name_api = '/playlist/get-playlist-detail' def _real_extract(self, url): + self.convert_oldDomain_to_newDomain(url) mobj = re.search(self._VALID_URL, url) playlist_id = mobj.group('playlist_id') return self._extract_playlist(id_playlist=playlist_id) @@ -546,6 +551,7 @@ class Zingmp3_vnUserIE(Zingmp3_vnIE): } def _real_extract(self, url): + self.convert_oldDomain_to_newDomain(url) mobj = re.search(self._VALID_URL, url) name = mobj.group('name') slug_name = mobj.group('slug_name') @@ -714,6 +720,7 @@ class Zingmp3_vnChartIE(Zingmp3_vnIE): } def _real_extract(self, url): + self.convert_oldDomain_to_newDomain(url) mobj = re.search(self._VALID_URL, url) name = mobj.group('name') slug_name = mobj.group('slug_name')