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,