]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videobam.py
fed95ef71120a7137b47d953dcb830e6ede59f23
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import int_or_none
10 class VideoBamIE(InfoExtractor
):
11 _VALID_URL
= r
'http://(?:www\.)?videobam\.com/(?:videos/download/)?(?P<id>[a-zA-Z]+)'
15 'url': 'http://videobam.com/OiJQM',
16 'md5': 'db471f27763a531f10416a0c58b5a1e0',
20 'title': 'Is Alcohol Worse Than Ecstasy?',
21 'description': 'md5:d25b96151515c91debc42bfbb3eb2683',
22 'uploader': 'frihetsvinge',
26 'url': 'http://videobam.com/pqLvq',
27 'md5': 'd9a565b5379a99126ef94e1d7f9a383e',
37 def _real_extract(self
, url
):
38 mobj
= re
.match(self
._VALID
_URL
, url
)
39 video_id
= mobj
.group('id')
41 page
= self
._download
_webpage
('http://videobam.com/%s' % video_id
, video_id
, 'Downloading page')
45 for preference
, format_id
in enumerate(['low', 'high']):
46 mobj
= re
.search(r
"%s: '(?P<url>[^']+)'" % format_id
, page
)
50 'url': mobj
.group('url'),
52 'format_id': format_id
,
53 'preference': preference
,
57 player_config
= json
.loads(self
._html
_search
_regex
(r
'var player_config = ({.+?});', page
, 'player config'))
61 } for item
in player_config
['playlist'] if 'autoPlay' in item
]
63 self
._sort
_formats
(formats
)
65 title
= self
._og
_search
_title
(page
, default
='_', fatal
=False)
66 description
= self
._og
_search
_description
(page
, default
=None)
67 thumbnail
= self
._og
_search
_thumbnail
(page
)
68 uploader
= self
._html
_search
_regex
(r
'Upload by ([^<]+)</a>', page
, 'uploader', fatal
=False, default
=None)
69 view_count
= int_or_none(
70 self
._html
_search
_regex
(r
'<strong>Views:</strong> (\d+) ', page
, 'view count', fatal
=False))
75 'description': description
,
76 'thumbnail': thumbnail
,
78 'view_count': view_count
,