- video = self._download_json(
- '%s/users/me/products/%s/chapters/%s/sections/%s'
- % (self._MAPT_REST, course_id, chapter_id, video_id), video_id,
- 'Downloading JSON video', headers=headers)['data']
-
- content = video.get('content')
- if not content:
- self.raise_login_required('This video is locked')
-
- video_url = content['file']
+ try:
+ video_url = self._download_json(
+ 'https://services.packtpub.com/products-v1/products/%s/%s/%s' % (course_id, chapter_id, video_id), video_id,
+ 'Downloading JSON video', headers=headers)['data']
+ except ExtractorError as e:
+ if isinstance(e.cause, compat_HTTPError) and e.cause.code == 400:
+ self.raise_login_required('This video is locked')
+ raise