]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/pbs.py
2 from __future__
import unicode_literals
6 from . common
import InfoExtractor
17 class PBSIE ( InfoExtractor
):
19 ( 'aptv.org' , 'APT - Alabama Public Television (WBIQ)' ), # http://aptv.org/
20 ( 'gpb.org' , 'GPB/Georgia Public Broadcasting (WGTV)' ), # http://www.gpb.org/
21 ( 'mpbonline.org' , 'Mississippi Public Broadcasting (WMPN)' ), # http://www.mpbonline.org
22 ( 'wnpt.org' , 'Nashville Public Television (WNPT)' ), # http://www.wnpt.org
23 ( 'wfsu.org' , 'WFSU-TV (WFSU)' ), # http://wfsu.org/
24 ( 'wsre.org' , 'WSRE (WSRE)' ), # http://www.wsre.org
25 ( 'wtcitv.org' , 'WTCI (WTCI)' ), # http://www.wtcitv.org
26 ( 'pba.org' , 'WPBA/Channel 30 (WPBA)' ), # http://pba.org/
27 ( 'alaskapublic.org' , 'Alaska Public Media (KAKM)' ), # http://alaskapublic.org/kakm
28 ( 'kuac.org' , 'KUAC (KUAC)' ), # http://kuac.org/kuac-tv/
29 ( 'ktoo.org' , '360 North (KTOO)' ), # http://www.ktoo.org/
30 ( 'azpm.org' , 'KUAT 6 (KUAT)' ), # http://www.azpm.org/
31 ( 'azpbs.org' , 'Arizona PBS (KAET)' ), # http://www.azpbs.org
32 ( 'newmexicopbs.org' , 'KNME-TV/Channel 5 (KNME)' ), # http://www.newmexicopbs.org/
33 ( 'vegaspbs.org' , 'Vegas PBS (KLVX)' ), # http://vegaspbs.org/
34 ( 'aetn.org' , 'AETN/ARKANSAS ETV NETWORK (KETS)' ), # http://www.aetn.org/
35 ( 'ket.org' , 'KET (WKLE)' ), # http://www.ket.org/
36 ( 'wkno.org' , 'WKNO/Channel 10 (WKNO)' ), # http://www.wkno.org/
37 ( 'lpb.org' , 'LPB/LOUISIANA PUBLIC BROADCASTING (WLPB)' ), # http://www.lpb.org/
38 ( 'oeta.tv' , 'OETA (KETA)' ), # http://www.oeta.tv
39 ( 'optv.org' , 'Ozarks Public Television (KOZK)' ), # http://www.optv.org/
40 ( 'wsiu.org' , 'WSIU Public Broadcasting (WSIU)' ), # http://www.wsiu.org/
41 ( 'keet.org' , 'KEET TV (KEET)' ), # http://www.keet.org
42 ( 'kixe.org' , 'KIXE/Channel 9 (KIXE)' ), # http://kixe.org/
43 ( 'kpbs.org' , 'KPBS San Diego (KPBS)' ), # http://www.kpbs.org/
44 ( 'kqed.org' , 'KQED (KQED)' ), # http://www.kqed.org
45 ( 'kvie.org' , 'KVIE Public Television (KVIE)' ), # http://www.kvie.org
46 ( 'pbssocal.org' , 'PBS SoCal/KOCE (KOCE)' ), # http://www.pbssocal.org/
47 ( 'valleypbs.org' , 'ValleyPBS (KVPT)' ), # http://www.valleypbs.org/
48 ( 'cptv.org' , 'CONNECTICUT PUBLIC TELEVISION (WEDH)' ), # http://cptv.org
49 ( 'knpb.org' , 'KNPB Channel 5 (KNPB)' ), # http://www.knpb.org/
50 ( 'soptv.org' , 'SOPTV (KSYS)' ), # http://www.soptv.org
51 ( 'klcs.org' , 'KLCS/Channel 58 (KLCS)' ), # http://www.klcs.org
52 ( 'krcb.org' , 'KRCB Television & Radio (KRCB)' ), # http://www.krcb.org
53 ( 'kvcr.org' , 'KVCR TV/DT/FM :: Vision for the Future (KVCR)' ), # http://kvcr.org
54 ( 'rmpbs.org' , 'Rocky Mountain PBS (KRMA)' ), # http://www.rmpbs.org
55 ( 'kenw.org' , 'KENW-TV3 (KENW)' ), # http://www.kenw.org
56 ( 'kued.org' , 'KUED Channel 7 (KUED)' ), # http://www.kued.org
57 ( 'wyomingpbs.org' , 'Wyoming PBS (KCWC)' ), # http://www.wyomingpbs.org
58 ( 'cpt12.org' , 'Colorado Public Television / KBDI 12 (KBDI)' ), # http://www.cpt12.org/
59 ( 'kbyutv.org' , 'KBYU-TV (KBYU)' ), # http://www.kbyutv.org/
60 ( 'thirteen.org' , 'Thirteen/WNET New York (WNET)' ), # http://www.thirteen.org
61 ( 'wgbh.org' , 'WGBH/Channel 2 (WGBH)' ), # http://wgbh.org
62 ( 'wgby.org' , 'WGBY (WGBY)' ), # http://www.wgby.org
63 ( 'njtvonline.org' , 'NJTV Public Media NJ (WNJT)' ), # http://www.njtvonline.org/
64 ( 'ripbs.org' , 'Rhode Island PBS (WSBE)' ), # http://www.ripbs.org/home/
65 ( 'wliw.org' , 'WLIW21 (WLIW)' ), # http://www.wliw.org/
66 ( 'mpt.org' , 'mpt/Maryland Public Television (WMPB)' ), # http://www.mpt.org
67 ( 'weta.org' , 'WETA Television and Radio (WETA)' ), # http://www.weta.org
68 ( 'whyy.org' , 'WHYY (WHYY)' ), # http://www.whyy.org
69 ( 'wlvt.org' , 'PBS 39 (WLVT)' ), # http://www.wlvt.org/
70 ( 'wvpt.net' , 'WVPT - Your Source for PBS and More! (WVPT)' ), # http://www.wvpt.net
71 ( 'whut.org' , 'Howard University Television (WHUT)' ), # http://www.whut.org
72 ( 'wedu.org' , 'WEDU PBS (WEDU)' ), # http://www.wedu.org
73 ( 'wgcu.org' , 'WGCU Public Media (WGCU)' ), # http://www.wgcu.org/
74 ( 'wjct.org' , 'WJCT Public Broadcasting (WJCT)' ), # http://www.wjct.org
75 ( 'wpbt2.org' , 'WPBT2 (WPBT)' ), # http://www.wpbt2.org
76 ( 'wucftv.org' , 'WUCF TV (WUCF)' ), # http://wucftv.org
77 ( 'wuft.org' , 'WUFT/Channel 5 (WUFT)' ), # http://www.wuft.org
78 ( 'wxel.org' , 'WXEL/Channel 42 (WXEL)' ), # http://www.wxel.org/home/
79 ( 'wlrn.org' , 'WLRN/Channel 17 (WLRN)' ), # http://www.wlrn.org/
80 ( 'wusf.org' , 'WUSF Public Broadcasting (WUSF)' ), # http://wusf.org/
81 ( 'scetv.org' , 'ETV (WRLK)' ), # http://www.scetv.org
82 ( 'unctv.org' , 'UNC-TV (WUNC)' ), # http://www.unctv.org/
83 ( 'pbsguam.org' , 'PBS Guam (KGTF)' ), # http://www.pbsguam.org/
84 ( 'pbshawaii.org' , 'PBS Hawaii - Oceanic Cable Channel 10 (KHET)' ), # http://www.pbshawaii.org/
85 ( 'idahoptv.org' , 'Idaho Public Television (KAID)' ), # http://idahoptv.org
86 ( 'ksps.org' , 'KSPS (KSPS)' ), # http://www.ksps.org/home/
87 ( 'opb.org' , 'OPB (KOPB)' ), # http://www.opb.org
88 ( 'kwsu.org' , 'KWSU/Channel 10 & KTNW/Channel 31 (KWSU)' ), # http://www.kwsu.org
89 ( 'illinois.edu' , 'WILL-TV (WILL)' ), # http://will.illinois.edu/
90 ( 'wsec.tv' , 'Network Knowledge - WSEC/Springfield (WSEC)' ), # http://www.wsec.tv
91 ( 'wttw.com' , 'WTTW11 (WTTW)' ), # http://www.wttw.com/
92 ( 'wtvp.org' , 'WTVP & WTVP.org, Public Media for Central Illinois (WTVP)' ), # http://www.wtvp.org/
93 ( 'iptv.org' , 'Iowa Public Television/IPTV (KDIN)' ), # http://www.iptv.org/
94 ( 'ninenet.org' , 'Nine Network (KETC)' ), # http://www.ninenet.org
95 ( 'wfwa.org' , 'PBS39 Fort Wayne (WFWA)' ), # http://wfwa.org/
96 ( 'wfyi.org' , 'WFYI Indianapolis (WFYI)' ), # http://www.wfyi.org
97 ( 'mptv.org' , 'Milwaukee Public Television (WMVS)' ), # http://www.mptv.org
98 ( 'wnin.org' , 'WNIN (WNIN)' ), # http://www.wnin.org/
99 ( 'wnit.org' , 'WNIT Public Television (WNIT)' ), # http://www.wnit.org/
100 ( 'wpt.org' , 'WPT (WPNE)' ), # http://www.wpt.org/
101 ( 'wvut.org' , 'WVUT/Channel 22 (WVUT)' ), # http://wvut.org/
102 ( 'weiu.net' , 'WEIU/Channel 51 (WEIU)' ), # http://www.weiu.net
103 ( 'wqpt.org' , 'WQPT-TV (WQPT)' ), # http://www.wqpt.org
104 ( 'wycc.org' , 'WYCC PBS Chicago (WYCC)' ), # http://www.wycc.org
105 ( 'lakeshorepublicmedia.org' , 'Lakeshore Public Television (WYIN)' ), # http://lakeshorepublicmedia.org/
106 ( 'wipb.org' , 'WIPB-TV (WIPB)' ), # http://wipb.org
107 ( 'indianapublicmedia.org' , 'WTIU (WTIU)' ), # http://indianapublicmedia.org/tv/
108 ( 'cetconnect.org' , 'CET (WCET)' ), # http://www.cetconnect.org
109 ( 'thinktv.org' , 'ThinkTVNetwork (WPTD)' ), # http://www.thinktv.org
110 ( 'wbgu.org' , 'WBGU-TV (WBGU)' ), # http://wbgu.org
111 ( 'wgvu.org' , 'WGVU TV (WGVU)' ), # http://www.wgvu.org/
112 ( 'netnebraska.org' , 'NET1 (KUON)' ), # http://netnebraska.org
113 ( 'pioneer.org' , 'Pioneer Public Television (KWCM)' ), # http://www.pioneer.org
114 ( 'sdpb.org' , 'SDPB Television (KUSD)' ), # http://www.sdpb.org
115 ( 'tpt.org' , 'TPT (KTCA)' ), # http://www.tpt.org
116 ( 'ksmq.org' , 'KSMQ (KSMQ)' ), # http://www.ksmq.org/
117 ( 'kpts.org' , 'KPTS/Channel 8 (KPTS)' ), # http://www.kpts.org/
118 ( 'ktwu.org' , 'KTWU/Channel 11 (KTWU)' ), # http://ktwu.org
119 ( 'shptv.org' , 'Smoky Hills Public Television (KOOD)' ), # http://www.shptv.org
120 ( 'kcpt.org' , 'KCPT Kansas City Public Television (KCPT)' ), # http://kcpt.org/
121 ( 'blueridgepbs.org' , 'Blue Ridge PBS (WBRA)' ), # http://www.blueridgepbs.org/
122 ( 'easttennesseepbs.org' , 'East Tennessee PBS (WSJK)' ), # http://easttennesseepbs.org
123 ( 'wcte.org' , 'WCTE-TV (WCTE)' ), # http://www.wcte.org
124 ( 'wljt.org' , 'WLJT, Channel 11 (WLJT)' ), # http://wljt.org/
125 ( 'wosu.org' , 'WOSU TV (WOSU)' ), # http://wosu.org/
126 ( 'woub.org' , 'WOUB/WOUC (WOUB)' ), # http://woub.org/tv/index.php?section=5
127 ( 'wvpublic.org' , 'WVPB (WVPB)' ), # http://wvpublic.org/
128 ( 'wkyupbs.org' , 'WKYU-PBS (WKYU)' ), # http://www.wkyupbs.org
129 ( 'wyes.org' , 'WYES-TV/New Orleans (WYES)' ), # http://www.wyes.org
130 ( 'kera.org' , 'KERA 13 (KERA)' ), # http://www.kera.org/
131 ( 'mpbn.net' , 'MPBN (WCBB)' ), # http://www.mpbn.net/
132 ( 'mountainlake.org' , 'Mountain Lake PBS (WCFE)' ), # http://www.mountainlake.org/
133 ( 'nhptv.org' , 'NHPTV (WENH)' ), # http://nhptv.org/
134 ( 'vpt.org' , 'Vermont PBS (WETK)' ), # http://www.vpt.org
135 ( 'witf.org' , 'witf (WITF)' ), # http://www.witf.org
136 ( 'wqed.org' , 'WQED Multimedia (WQED)' ), # http://www.wqed.org/
137 ( 'wmht.org' , 'WMHT Educational Telecommunications (WMHT)' ), # http://www.wmht.org/home/
138 ( 'deltabroadcasting.org' , 'Q-TV (WDCQ)' ), # http://www.deltabroadcasting.org
139 ( 'dptv.org' , 'WTVS Detroit Public TV (WTVS)' ), # http://www.dptv.org/
140 ( 'wcmu.org' , 'CMU Public Television (WCMU)' ), # http://www.wcmu.org
141 ( 'wkar.org' , 'WKAR-TV (WKAR)' ), # http://wkar.org/
142 ( 'nmu.edu' , 'WNMU-TV Public TV 13 (WNMU)' ), # http://wnmutv.nmu.edu
143 ( 'wdse.org' , 'WDSE - WRPT (WDSE)' ), # http://www.wdse.org/
144 ( 'wgte.org' , 'WGTE TV (WGTE)' ), # http://www.wgte.org
145 ( 'lakelandptv.org' , 'Lakeland Public Television (KAWE)' ), # http://www.lakelandptv.org
146 ( 'prairiepublic.org' , 'PRAIRIE PUBLIC (KFME)' ), # http://www.prairiepublic.org/
147 ( 'kmos.org' , 'KMOS-TV - Channels 6.1, 6.2 and 6.3 (KMOS)' ), # http://www.kmos.org/
148 ( 'montanapbs.org' , 'MontanaPBS (KUSM)' ), # http://montanapbs.org
149 ( 'krwg.org' , 'KRWG/Channel 22 (KRWG)' ), # http://www.krwg.org
150 ( 'panhandlepbs.org' , 'KACV (KACV)' ), # http://www.panhandlepbs.org/home/
151 ( 'kcostv.org' , 'KCOS/Channel 13 (KCOS)' ), # www.kcostv.org
152 ( 'wcny.org' , 'WCNY/Channel 24 (WCNY)' ), # http://www.wcny.org
153 ( 'wned.org' , 'WNED (WNED)' ), # http://www.wned.org/
154 ( 'wpbstv.org' , 'WPBS (WPBS)' ), # http://www.wpbstv.org
155 ( 'wskg.org' , 'WSKG Public TV (WSKG)' ), # http://wskg.org
156 ( 'wxxi.org' , 'WXXI (WXXI)' ), # http://wxxi.org
157 ( 'wpsu.org' , 'WPSU (WPSU)' ), # http://www.wpsu.org
158 ( 'wqln.org' , 'WQLN/Channel 54 (WQLN)' ), # http://www.wqln.org
159 ( 'wvia.org' , 'WVIA Public Media Studios (WVIA)' ), # http://www.wvia.org/
160 ( 'wtvi.org' , 'WTVI (WTVI)' ), # http://www.wtvi.org/
161 ( 'whro.org' , 'WHRO (WHRO)' ), # http://whro.org
162 ( 'WesternReservePublicMedia.org' , 'Western Reserve PBS (WNEO)' ), # http://www.WesternReservePublicMedia.org/
163 ( 'wviz.org' , 'WVIZ/PBS ideastream (WVIZ)' ), # http://www.wviz.org/
164 ( 'kcts9.org' , 'KCTS 9 (KCTS)' ), # http://kcts9.org/
165 ( 'basinpbs.org' , 'Basin PBS (KPBT)' ), # http://www.basinpbs.org
166 ( 'houstonpublicmedia.org' , 'KUHT / Channel 8 (KUHT)' ), # http://www.houstonpublicmedia.org/
167 ( 'tamu.edu' , 'KAMU - TV (KAMU)' ), # http://KAMU.tamu.edu
168 ( 'kedt.org' , 'KEDT/Channel 16 (KEDT)' ), # http://www.kedt.org
169 ( 'klrn.org' , 'KLRN (KLRN)' ), # http://www.klrn.org
170 ( 'klru.org' , 'KLRU (KLRU)' ), # http://www.klru.org
171 ( 'kmbh.org' , 'KMBH-TV (KMBH)' ), # http://www.kmbh.org
172 ( 'knct.org' , 'KNCT (KNCT)' ), # http://www.knct.org
173 ( 'ktxt.org' , 'KTTZ-TV (KTXT)' ), # http://www.ktxt.org
174 ( 'wtjx.org' , 'WTJX Channel 12 (WTJX)' ), # http://www.wtjx.org/
175 ( 'ideastations.org' , 'WCVE PBS (WCVE)' ), # http://ideastations.org/
176 ( 'kbtc.org' , 'KBTC Public Television (KBTC)' ), # http://kbtc.org
180 IE_DESC
= 'Public Broadcasting Service (PBS) and member stations: %s ' % ', ' . join ( list ( zip (* _STATIONS
))[ 1 ])
182 _VALID_URL
= r
'''(?x)https?://
185 (?:videos?|watch)\.(?: %s )/(?:viralplayer|video)/(?P<id>[0-9]+)/? |
186 # Article with embedded player (or direct video)
187 (?:www\.)?pbs\.org/(?:[^/]+/) {2,5} (?P<presumptive_id>[^/]+?)(?:\.html)?/?(?:$|[?\#]) |
189 (?:video|player)\.pbs\.org/(?:widget/)?partnerplayer/(?P<player_id>[^/]+)/
191 ''' % '|' . join ( list ( zip (* _STATIONS
))[ 0 ])
195 'url' : 'http://www.pbs.org/tpt/constitution-usa-peter-sagal/watch/a-more-perfect-union/' ,
196 'md5' : 'ce1888486f0908d555a8093cac9a7362' ,
200 'title' : 'Constitution USA with Peter Sagal - A More Perfect Union' ,
201 'description' : 'md5:ba0c207295339c8d6eced00b7c363c6a' ,
205 'skip_download' : True , # requires ffmpeg
209 'url' : 'http://www.pbs.org/wgbh/pages/frontline/losing-iraq/' ,
210 'md5' : '143c98aa54a346738a3d78f54c925321' ,
214 'title' : 'FRONTLINE - Losing Iraq' ,
215 'description' : 'md5:f5bfbefadf421e8bb8647602011caf8e' ,
219 'skip_download' : True , # requires ffmpeg
223 'url' : 'http://www.pbs.org/newshour/bb/education-jan-june12-cyberschools_02-23/' ,
224 'md5' : 'b19856d7f5351b17a5ab1dc6a64be633' ,
228 'title' : 'PBS NewsHour - Cyber Schools Gain Popularity, but Quality Questions Persist' ,
229 'description' : 'md5:5871c15cba347c1b3d28ac47a73c7c28' ,
234 'url' : 'http://www.pbs.org/wnet/gperf/dudamel-conducts-verdi-requiem-hollywood-bowl-full-episode/3374/' ,
235 'md5' : 'c62859342be2a0358d6c9eb306595978' ,
239 'description' : 'md5:68d87ef760660eb564455eb30ca464fe' ,
240 'title' : 'Great Performances - Dudamel Conducts Verdi Requiem at the Hollywood Bowl - Full' ,
242 'thumbnail' : 're:^https?://.*\.jpg$' ,
245 'skip_download' : True , # requires ffmpeg
249 'url' : 'http://www.pbs.org/wgbh/nova/earth/killer-typhoon.html' ,
250 'md5' : '908f3e5473a693b266b84e25e1cf9703' ,
253 'display_id' : 'killer-typhoon' ,
255 'description' : 'md5:c741d14e979fc53228c575894094f157' ,
256 'title' : 'NOVA - Killer Typhoon' ,
258 'thumbnail' : 're:^https?://.*\.jpg$' ,
259 'upload_date' : '20140122' ,
263 'skip_download' : True , # requires ffmpeg
267 'url' : 'http://www.pbs.org/wgbh/pages/frontline/united-states-of-secrets/' ,
269 'id' : 'united-states-of-secrets' ,
274 'url' : 'http://www.pbs.org/wgbh/americanexperience/films/death/player/' ,
277 'display_id' : 'player' ,
279 'title' : 'American Experience - Death and the Civil War, Chapter 1' ,
280 'description' : 'American Experience, TV’s most-watched history series, brings to life the compelling stories from our past that inform our understanding of the world today.' ,
282 'thumbnail' : 're:^https?://.*\.jpg$' ,
285 'skip_download' : True , # requires ffmpeg
289 'url' : 'http://video.pbs.org/video/2365367186/' ,
292 'display_id' : '2365367186' ,
294 'title' : 'To Catch A Comet - Full Episode' ,
295 'description' : 'On November 12, 2014, billions of kilometers from Earth, spacecraft orbiter Rosetta and lander Philae did what no other had dared to attempt \u2014 land on the volatile surface of a comet as it zooms around the sun at 67,000 km/hr. The European Space Agency hopes this mission can help peer into our past and unlock secrets of our origins.' ,
297 'thumbnail' : 're:^https?://.*\.jpg$' ,
300 'skip_download' : True , # requires ffmpeg
305 # Video embedded in iframe containing angle brackets as attribute's value (e.g.
306 # "<iframe style='position: absolute;<br />\ntop: 0; left: 0;' ...", see
307 # https://github.com/rg3/youtube-dl/issues/7059)
308 'url' : 'http://www.pbs.org/food/features/a-chefs-life-season-3-episode-5-prickly-business/' ,
311 'display_id' : 'a-chefs-life-season-3-episode-5-prickly-business' ,
313 'title' : "A Chef's Life - Season 3, Ep. 5: Prickly Business" ,
314 'description' : 'md5:61db2ddf27c9912f09c241014b118ed1' ,
316 'thumbnail' : 're:^https?://.*\.jpg$' ,
319 'skip_download' : True , # requires ffmpeg
323 # Frontline video embedded via flp2012.js
324 'url' : 'http://www.pbs.org/wgbh/pages/frontline/the-atomic-artists' ,
327 'display_id' : 'the-atomic-artists' ,
329 'title' : 'FRONTLINE - The Atomic Artists' ,
330 'description' : 'md5:f5bfbefadf421e8bb8647602011caf8e' ,
332 'thumbnail' : 're:^https?://.*\.jpg$' ,
335 'skip_download' : True , # requires ffmpeg
339 'url' : 'http://player.pbs.org/widget/partnerplayer/2365297708/?start=0&end=0&chapterbar=false&endscreen=false&topbar=true' ,
340 'only_matching' : True ,
343 'url' : 'http://watch.knpb.org/video/2365616055/' ,
344 'only_matching' : True ,
348 101 : 'We \' re sorry, but this video is not yet available.' ,
349 403 : 'We \' re sorry, but this video is not available in your region due to right restrictions.' ,
350 404 : 'We are experiencing technical difficulties that are preventing us from playing the video at this time. Please check back again soon.' ,
351 410 : 'This video has expired and is no longer available for online streaming.' ,
354 def _extract_webpage ( self
, url
):
355 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
357 presumptive_id
= mobj
. group ( 'presumptive_id' )
358 display_id
= presumptive_id
360 webpage
= self
._ download
_ webpage
( url
, display_id
)
362 upload_date
= unified_strdate ( self
._ search
_ regex
(
363 r
'<input type="hidden" id="air_date_[0-9]+" value="([^"]+)"' ,
364 webpage
, 'upload date' , default
= None ))
366 # tabbed frontline videos
367 tabbed_videos
= re
. findall (
368 r
'<div[^>]+class="videotab[^"]*"[^>]+vid="(\d+)"' , webpage
)
370 return tabbed_videos
, presumptive_id
, upload_date
373 r
"div\s*:\s*'videoembed'\s*,\s*mediaid\s*:\s*'(\d+)'" , # frontline video embed
374 r
'class="coveplayerid">([^<]+)<' , # coveplayer
375 r
'<section[^>]+data-coveid="(\d+)"' , # coveplayer from http://www.pbs.org/wgbh/frontline/film/real-csi/
376 r
'<input type="hidden" id="pbs_video_id_[0-9]+" value="([0-9]+)"/>' , # jwplayer
379 media_id
= self
._ search
_ regex
(
380 MEDIA_ID_REGEXES
, webpage
, 'media ID' , fatal
= False , default
= None )
382 return media_id
, presumptive_id
, upload_date
384 # Fronline video embedded via flp
385 video_id
= self
._ search
_ regex
(
386 r
'videoid\s*:\s*"([\d+a-z] {7,} )"' , webpage
, 'videoid' , default
= None )
388 # pkg_id calculation is reverse engineered from
389 # http://www.pbs.org/wgbh/pages/frontline/js/flp2012.js
390 prg_id
= self
._ search
_ regex
(
391 r
'videoid\s*:\s*"([\d+a-z] {7,} )"' , webpage
, 'videoid' )[ 7 :]
393 prg_id
= prg_id
. split ( 'q' )[ 1 ]
394 prg_id
= int ( prg_id
, 16 )
395 getdir
= self
._ download
_ json
(
396 'http://www.pbs.org/wgbh/pages/frontline/.json/getdir/getdir %d .json' % prg_id
,
397 presumptive_id
, 'Downloading getdir JSON' ,
398 transform_source
= strip_jsonp
)
399 return getdir
[ 'mid' ], presumptive_id
, upload_date
401 for iframe
in re
. findall ( r
'(?s)<iframe(.+?)></iframe>' , webpage
):
402 url
= self
._ search
_ regex
(
403 r
'src=(["\' ])( ?P
< url
>.+ ?partnerplayer
.+ ?
) \
1 ', iframe,
404 ' player URL
', default=None, group=' url
')
408 mobj = re.match(self._VALID_URL, url)
410 player_id = mobj.group(' player_id
')
412 display_id = player_id
414 player_page = self._download_webpage(
415 url, display_id, note=' Downloading player page
',
416 errnote=' Could
not download player page
')
417 video_id = self._search_regex(
418 r' < div\s
+ id = "video_([0-9]+)" ', player_page, ' video ID
')
420 video_id = mobj.group(' id ')
421 display_id = video_id
423 return video_id, display_id, None
425 def _real_extract(self, url):
426 video_id, display_id, upload_date = self._extract_webpage(url)
428 if isinstance(video_id, list):
429 entries = [self.url_result(
430 ' http
:// video
. pbs
. org
/ video
/ %s ' % vid_id, ' PBS
', vid_id)
431 for vid_id in video_id]
432 return self.playlist_result(entries, display_id)
434 info = self._download_json(
435 ' http
:// player
. pbs
. org
/ videoInfo
/ %s ?format
= json
& type = partner
' % video_id,
439 for encoding_name in (' recommended_encoding
', ' alternate_encoding
'):
440 redirect = info.get(encoding_name)
443 redirect_url = redirect.get(' url
')
447 redirect_info = self._download_json(
448 redirect_url + ' ?format
= json
', display_id,
449 ' Downloading
%s video url info
' % encoding_name)
451 if redirect_info[' status
'] == ' error
':
452 raise ExtractorError(
455 self._ERRORS.get(redirect_info[' http_code
'], redirect_info[' message
'])),
458 format_url = redirect_info.get(' url
')
462 if determine_ext(format_url) == ' m3u8
':
463 formats.extend(self._extract_m3u8_formats(
464 format_url, display_id, ' mp4
', preference=1, m3u8_id=' hls
'))
468 ' format_id
': redirect.get(' eeid
'),
470 self._sort_formats(formats)
472 rating_str = info.get(' rating
')
473 if rating_str is not None:
474 rating_str = rating_str.rpartition(' - ')[2]
475 age_limit = US_RATINGS.get(rating_str)
478 closed_captions_url = info.get(' closed_captions_url
')
479 if closed_captions_url:
482 ' url
': closed_captions_url,
485 # info[' title
'] is often incomplete (e.g. ' Full Episode
', ' Episode
5 ', etc)
486 # Try turning it to ' program
- title
' naming scheme if possible
487 alt_title = info.get(' program
', {}).get(' title
')
489 info[' title
'] = alt_title + ' - ' + re.sub(r' ^
' + alt_title + ' [ \s\
-:]+ ', ' ', info[' title
'])
493 ' display_id
': display_id,
494 ' title
': info[' title
'],
495 ' description
': info[' program
'].get(' description
'),
496 ' thumbnail
': info.get(' image_url
'),
497 ' duration
': int_or_none(info.get(' duration
')),
498 ' age_limit
': age_limit,
499 ' upload_date
': upload_date,
501 ' subtitles
': subtitles,