]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/commonprotocols.py
Merge pull request #1 from e7appew/python3
[youtubedl] / youtube_dl / extractor / commonprotocols.py
1 from __future__ import unicode_literals
2
3 import os
4
5 from .common import InfoExtractor
6 from ..compat import (
7 compat_urllib_parse_unquote,
8 compat_urlparse,
9 )
10 from ..utils import url_basename
11
12
13 class RtmpIE(InfoExtractor):
14 IE_DESC = False # Do not list
15 _VALID_URL = r'(?i)rtmp[est]?://.+'
16
17 _TESTS = [{
18 'url': 'rtmp://cp44293.edgefcs.net/ondemand?auth=daEcTdydfdqcsb8cZcDbAaCbhamacbbawaS-bw7dBb-bWG-GqpGFqCpNCnGoyL&aifp=v001&slist=public/unsecure/audio/2c97899446428e4301471a8cb72b4b97--audio--pmg-20110908-0900a_flv_aac_med_int.mp4',
19 'only_matching': True,
20 }, {
21 'url': 'rtmp://edge.live.hitbox.tv/live/dimak',
22 'only_matching': True,
23 }]
24
25 def _real_extract(self, url):
26 video_id = compat_urllib_parse_unquote(os.path.splitext(url.rstrip('/').split('/')[-1])[0])
27 title = compat_urllib_parse_unquote(os.path.splitext(url_basename(url))[0])
28 return {
29 'id': video_id,
30 'title': title,
31 'formats': [{
32 'url': url,
33 'ext': 'flv',
34 'format_id': compat_urlparse.urlparse(url).scheme,
35 }],
36 }