]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/theintercept.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   5 from ..compat 
import compat_str
 
  13 class TheInterceptIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https://theintercept.com/fieldofvision/(?P<id>[^/?#]+)' 
  16         'url': 'https://theintercept.com/fieldofvision/thisisacoup-episode-four-surrender-or-die/', 
  17         'md5': '145f28b41d44aab2f87c0a4ac8ec95bd', 
  21             'title': '#ThisIsACoup – Episode Four: Surrender or Die', 
  22             'description': 'md5:74dd27f0e2fbd50817829f97eaa33140', 
  23             'timestamp': 1450429239, 
  24             'upload_date': '20151218', 
  29     def _real_extract(self
, url
): 
  30         display_id 
= self
._match
_id
(url
) 
  31         webpage 
= self
._download
_webpage
(url
, display_id
) 
  33         json_data 
= self
._parse
_json
(self
._search
_regex
( 
  34             r
'initialStoreTree\s*=\s*(?P<json_data>{.+})', webpage
, 
  35             'initialStoreTree'), display_id
) 
  37         for post 
in json_data
['resources']['posts'].values(): 
  38             if post
['slug'] == display_id
: 
  40                     '_type': 'url_transparent', 
  41                     'url': 'jwplatform:%s' % post
['fov_videoid'], 
  42                     'id': compat_str(post
['ID']), 
  43                     'display_id': display_id
, 
  44                     'title': post
['title'], 
  45                     'description': post
.get('excerpt'), 
  46                     'timestamp': parse_iso8601(post
.get('date')), 
  47                     'comment_count': int_or_none(post
.get('comments_number')), 
  49         raise ExtractorError('Unable to find the current post')