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

[NokiaTune] Add extractor #4259

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions yt_dlp/extractor/_extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@
from .nitter import NitterIE
from .njpwworld import NJPWWorldIE
from .nobelprize import NobelPrizeIE
from .nokiatune import NokiaTuneIE
from .nonktube import NonkTubeIE
from .noodlemagazine import NoodleMagazineIE
from .noovo import NoovoIE
Expand Down
35 changes: 35 additions & 0 deletions yt_dlp/extractor/nokiatune.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from .common import InfoExtractor


class NokiaTuneIE(InfoExtractor):
_VALID_URL = r'https?://nokiatune\.audiodraft\.com/entry/(?P<id>\d+)'

_TESTS = [{
'url': 'http://nokiatune.audiodraft.com/entry/5874',
'info_dict': {
'id': '5874',
'title': 'Playing: Hula Hula Calls',
'uploader': 'unclemaki',
'ext': 'mp3'
}
}]

def _real_extract(self, url):
id = self._match_id(url)
webpage = self._download_webpage(url, id)
play_entry_id = self._search_regex(r'(player_entry_\d+)', webpage, id, 'play entry id')

data_json = self._download_json('http://nokiatune.audiodraft.com/ajax_player/entryinfo', id,
headers={
'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
'X-Requested-With': 'XMLHttpRequest'
}, data=f'id={play_entry_id}'.encode())

return {
'id': id,
'title': data_json.get('player_text'),
'url': data_json['path'],
'vcodec': 'none',
'ext': 'mp3',
'uploader': self._search_regex(r'"artist"[^>]*>([^<]+)', webpage, id, fatal=False)
}