]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/washingtonpost.py
2 from __future__
import unicode_literals
6 from . common
import InfoExtractor
9 class WashingtonPostIE ( InfoExtractor
):
10 IE_NAME
= 'washingtonpost'
11 _VALID_URL
= r
'(?:washingtonpost:|https?://(?:www\.)?washingtonpost\.com/(?:video|posttv)/(?:[^/]+/)*)(?P<id>[\da-f] {8} -[\da-f] {4} -[\da-f] {4} -[\da-f] {4} -[\da-f] {12} )'
12 _EMBED_URL
= r
'https?://(?:www\.)?washingtonpost\.com/video/c/embed/[\da-f] {8} -[\da-f] {4} -[\da-f] {4} -[\da-f] {4} -[\da-f] {12} '
14 'url' : 'https://www.washingtonpost.com/video/c/video/480ba4ee-1ec7-11e6-82c2-a7dcb313287d' ,
15 'md5' : '6f537e1334b714eb15f9563bd4b9cdfa' ,
17 'id' : '480ba4ee-1ec7-11e6-82c2-a7dcb313287d' ,
19 'title' : 'Egypt finds belongings, debris from plane crash' ,
20 'description' : 'md5:a17ceee432f215a5371388c1f680bd86' ,
21 'upload_date' : '20160520' ,
22 'timestamp' : 1463775187 ,
25 'url' : 'https://www.washingtonpost.com/video/world/egypt-finds-belongings-debris-from-plane-crash/2016/05/20/480ba4ee-1ec7-11e6-82c2-a7dcb313287d_video.html' ,
26 'only_matching' : True ,
28 'url' : 'https://www.washingtonpost.com/posttv/world/iraq-to-track-down-antiquities-after-islamic-state-museum-rampage/2015/02/28/7c57e916-bf86-11e4-9dfb-03366e719af8_video.html' ,
29 'only_matching' : True ,
33 def _extract_urls ( cls
, webpage
):
35 r
'<iframe[^>]+\bsrc=["\' ]( %s) ' % cls._EMBED_URL, webpage)
37 def _real_extract(self, url):
38 video_id = self._match_id(url)
39 return self.url_result(
40 ' arcpublishing
: wapo
: ' + video_id, ' ArcPublishing
', video_id)
43 class WashingtonPostArticleIE(InfoExtractor):
44 IE_NAME = ' washingtonpost
: article
'
45 _VALID_URL = r' https?
://( ?
: www\
.) ?washingtonpost\
. com
/( ?
:[ ^
/]+/)*( ?P
< id >[ ^
/ ?
#]+)'
47 'url' : 'http://www.washingtonpost.com/sf/national/2014/03/22/sinkhole-of-bureaucracy/' ,
49 'id' : 'sinkhole-of-bureaucracy' ,
50 'title' : 'Sinkhole of bureaucracy' ,
53 'md5' : 'b9be794ceb56c7267d410a13f99d801a' ,
55 'id' : 'fc433c38-b146-11e3-b8b3-44b1d1cd4c1f' ,
57 'title' : 'Breaking Points: The Paper Mine' ,
59 'description' : 'Overly complicated paper pushing is nothing new to government bureaucracy. But the way federal retirement applications are filed may be the most outdated. David Fahrenthold explains.' ,
60 'timestamp' : 1395440416 ,
61 'upload_date' : '20140321' ,
64 'md5' : '1fff6a689d8770966df78c8cb6c8c17c' ,
66 'id' : '41255e28-b14a-11e3-b8b3-44b1d1cd4c1f' ,
68 'title' : 'The town bureaucracy sustains' ,
69 'description' : 'Underneath the friendly town of Boyers is a sea of government paperwork. In a disused limestone mine, hundreds of locals now track, file and process retirement applications for the federal government. We set out to find out what it \' s like to do paperwork 230 feet underground.' ,
71 'timestamp' : 1395441819 ,
72 'upload_date' : '20140321' ,
76 'url' : 'http://www.washingtonpost.com/blogs/wonkblog/wp/2014/12/31/one-airline-figured-out-how-to-make-sure-its-airplanes-never-disappear/' ,
78 'id' : 'one-airline-figured-out-how-to-make-sure-its-airplanes-never-disappear' ,
79 'title' : 'One airline figured out how to make sure its airplanes never disappear' ,
82 'md5' : 'a7c1b5634ba5e57a6a82cdffa5b1e0d0' ,
84 'id' : '0e4bb54c-9065-11e4-a66f-0ca5037a597d' ,
86 'description' : 'Washington Post transportation reporter Ashley Halsey III explains why a plane \' s black box needs to be recovered from a crash site instead of having its information streamed in real time throughout the flight.' ,
87 'upload_date' : '20141230' ,
88 'timestamp' : 1419972442 ,
89 'title' : 'Why black boxes don’t transmit data in real time' ,
95 def suitable ( cls
, url
):
96 return False if WashingtonPostIE
. suitable ( url
) else super ( WashingtonPostArticleIE
, cls
). suitable ( url
)
98 def _real_extract ( self
, url
):
99 page_id
= self
._ match
_ id
( url
)
100 webpage
= self
._ download
_ webpage
( url
, page_id
)
102 title
= self
._ og
_ search
_ title
( webpage
)
104 uuids
= re
. findall ( r
'''(?x)
106 <div\s+class="posttv-video-embed[^>]*?data-uuid=|
108 )"([^"]+)"''' , webpage
)
109 entries
= [ self
. url_result ( 'washingtonpost: %s ' % uuid
, 'WashingtonPost' , uuid
) for uuid
in uuids
]