+
+
+class HBOIE(HBOBaseIE):
+ _VALID_URL = r'https?://(?:www\.)?hbo\.com/video/video\.html\?.*vid=(?P<id>[0-9]+)'
+ _TEST = {
+ 'url': 'http://www.hbo.com/video/video.html?autoplay=true&g=u&vid=1437839',
+ 'md5': '1c33253f0c7782142c993c0ba62a8753',
+ 'info_dict': {
+ 'id': '1437839',
+ 'ext': 'mp4',
+ 'title': 'Ep. 64 Clip: Encryption',
+ 'thumbnail': 're:https?://.*\.jpg$',
+ 'duration': 1072,
+ }
+ }
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ return self._extract_from_id(video_id)
+
+
+class HBOEpisodeIE(HBOBaseIE):
+ _VALID_URL = r'https?://(?:www\.)?hbo\.com/(?!video)([^/]+/)+video/(?P<id>[0-9a-z-]+)\.html'
+
+ _TESTS = [{
+ 'url': 'http://www.hbo.com/girls/episodes/5/52-i-love-you-baby/video/ep-52-inside-the-episode.html?autoplay=true',
+ 'md5': '689132b253cc0ab7434237fc3a293210',
+ 'info_dict': {
+ 'id': '1439518',
+ 'display_id': 'ep-52-inside-the-episode',
+ 'ext': 'mp4',
+ 'title': 'Ep. 52: Inside the Episode',
+ 'thumbnail': 're:https?://.*\.jpg$',
+ 'duration': 240,
+ },
+ }, {
+ 'url': 'http://www.hbo.com/game-of-thrones/about/video/season-5-invitation-to-the-set.html?autoplay=true',
+ 'only_matching': True,
+ }]
+
+ def _real_extract(self, url):
+ display_id = self._match_id(url)
+
+ webpage = self._download_webpage(url, display_id)
+
+ video_id = self._search_regex(
+ r'(?P<q1>[\'"])videoId(?P=q1)\s*:\s*(?P<q2>[\'"])(?P<video_id>\d+)(?P=q2)',
+ webpage, 'video ID', group='video_id')
+
+ info_dict = self._extract_from_id(video_id)
+ info_dict['display_id'] = display_id
+
+ return info_dict