mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 06:10:12 +01:00
[hungama] Add extractor
This commit is contained in:
parent
0266854f63
commit
8cb5c2181a
|
@ -469,6 +469,7 @@
|
|||
)
|
||||
from .huajiao import HuajiaoIE
|
||||
from .huffpost import HuffPostIE
|
||||
from .hungama import HungamaIE
|
||||
from .hypem import HypemIE
|
||||
from .iconosquare import IconosquareIE
|
||||
from .ign import (
|
||||
|
|
32
youtube_dl/extractor/hungama.py
Normal file
32
youtube_dl/extractor/hungama.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .common import InfoExtractor
|
||||
|
||||
|
||||
class HungamaIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)hungama\.com/song/[\w\d-]+/(?P<id>[0-9]+)'
|
||||
_TEST = {
|
||||
'url': 'https://www.hungama.com/song/kitni-haseen-zindagi/2931166/',
|
||||
'md5': '396fa7e8e7e67aa25da0edc4cac9b785',
|
||||
'info_dict': {
|
||||
'id': '2931166',
|
||||
'ext': 'mp4',
|
||||
'title': 'Kitni Haseen Zindagi',
|
||||
}
|
||||
}
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
player_data = self._download_json('https://www.hungama.com/audio-player-data/track/%s?_country=IN' % video_id, video_id)[0]
|
||||
title = player_data.get('song_name') or self._og_search_title(webpage)
|
||||
track_data = self._download_json(player_data['file'], video_id)
|
||||
media_url = track_data['response']['media_url']
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'title': title,
|
||||
'formats': self._extract_m3u8_formats(media_url, video_id, ext='mp4'),
|
||||
}
|
Loading…
Reference in New Issue
Block a user