]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/playfm.py
1 from .common
import InfoExtractor
2 from ..compat
import compat_str
10 class PlayFMIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?play\.fm/(?P<slug>(?:[^/]+/)+(?P<id>[^/]+))/?(?:$|[?#])'
15 'url': 'https://www.play.fm/dan-drastic/sven-tasnadi-leipzig-electronic-music-batofar-paris-fr-2014-07-12',
16 'md5': 'c505f8307825a245d0c7ad1850001f22',
20 'title': 'Sven Tasnadi - LEIPZIG ELECTRONIC MUSIC @ Batofar (Paris,FR) - 2014-07-12',
23 'timestamp': 1406033781,
24 'upload_date': '20140722',
25 'uploader': 'Dan Drastic',
26 'uploader_id': '71170',
32 def _real_extract(self
, url
):
33 mobj
= self
._match
_valid
_url
(url
)
34 video_id
= mobj
.group('id')
35 slug
= mobj
.group('slug')
37 recordings
= self
._download
_json
(
38 'http://v2api.play.fm/recordings/slug/%s' % slug
, video_id
)
40 error
= recordings
.get('error')
41 if isinstance(error
, dict):
43 '%s returned error: %s' % (self
.IE_NAME
, error
.get('message')),
46 audio_url
= recordings
['audio']
47 video_id
= compat_str(recordings
.get('id') or video_id
)
48 title
= recordings
['title']
49 description
= recordings
.get('description')
50 duration
= int_or_none(recordings
.get('recordingDuration'))
51 timestamp
= parse_iso8601(recordings
.get('created_at'))
52 uploader
= recordings
.get('page', {}).get('title')
53 uploader_id
= compat_str(recordings
.get('page', {}).get('id'))
54 view_count
= int_or_none(recordings
.get('playCount'))
55 comment_count
= int_or_none(recordings
.get('commentCount'))
56 categories
= [tag
['name'] for tag
in recordings
.get('tags', []) if tag
.get('name')]
62 'description': description
,
64 'timestamp': timestamp
,
66 'uploader_id': uploader_id
,
67 'view_count': view_count
,
68 'comment_count': comment_count
,
69 'categories': categories
,