]>
Commit | Line | Data |
---|---|---|
9779b63b | 1 | import re |
9779b63b JMF |
2 | |
3 | from .common import InfoExtractor | |
87f89dac | 4 | from ..compat import compat_str |
a1a530b0 | 5 | from ..utils import ( |
f86d543e | 6 | ExtractorError, |
5890eef6 S |
7 | determine_ext, |
8 | int_or_none, | |
7a6d33a9 | 9 | float_or_none, |
7fcea295 | 10 | js_to_json, |
4947f13c | 11 | orderedSet, |
686f9881 | 12 | strip_jsonp, |
542130a5 | 13 | strip_or_none, |
27aede90 | 14 | unified_strdate, |
6f2d82a5 | 15 | url_or_none, |
a1a530b0 PH |
16 | US_RATINGS, |
17 | ) | |
9779b63b JMF |
18 | |
19 | ||
20 | class PBSIE(InfoExtractor): | |
e15e2ef7 | 21 | _STATIONS = ( |
2c566d02 | 22 | (r'(?:video|www|player)\.pbs\.org', 'PBS: Public Broadcasting Service'), # http://www.pbs.org/ |
8f0afda0 S |
23 | (r'video\.aptv\.org', 'APT - Alabama Public Television (WBIQ)'), # http://aptv.org/ |
24 | (r'video\.gpb\.org', 'GPB/Georgia Public Broadcasting (WGTV)'), # http://www.gpb.org/ | |
25 | (r'video\.mpbonline\.org', 'Mississippi Public Broadcasting (WMPN)'), # http://www.mpbonline.org | |
26 | (r'video\.wnpt\.org', 'Nashville Public Television (WNPT)'), # http://www.wnpt.org | |
27 | (r'video\.wfsu\.org', 'WFSU-TV (WFSU)'), # http://wfsu.org/ | |
28 | (r'video\.wsre\.org', 'WSRE (WSRE)'), # http://www.wsre.org | |
29 | (r'video\.wtcitv\.org', 'WTCI (WTCI)'), # http://www.wtcitv.org | |
30 | (r'video\.pba\.org', 'WPBA/Channel 30 (WPBA)'), # http://pba.org/ | |
31 | (r'video\.alaskapublic\.org', 'Alaska Public Media (KAKM)'), # http://alaskapublic.org/kakm | |
32 | # (r'kuac\.org', 'KUAC (KUAC)'), # http://kuac.org/kuac-tv/ | |
33 | # (r'ktoo\.org', '360 North (KTOO)'), # http://www.ktoo.org/ | |
34 | # (r'azpm\.org', 'KUAT 6 (KUAT)'), # http://www.azpm.org/ | |
35 | (r'video\.azpbs\.org', 'Arizona PBS (KAET)'), # http://www.azpbs.org | |
36 | (r'portal\.knme\.org', 'KNME-TV/Channel 5 (KNME)'), # http://www.newmexicopbs.org/ | |
37 | (r'video\.vegaspbs\.org', 'Vegas PBS (KLVX)'), # http://vegaspbs.org/ | |
38 | (r'watch\.aetn\.org', 'AETN/ARKANSAS ETV NETWORK (KETS)'), # http://www.aetn.org/ | |
39 | (r'video\.ket\.org', 'KET (WKLE)'), # http://www.ket.org/ | |
40 | (r'video\.wkno\.org', 'WKNO/Channel 10 (WKNO)'), # http://www.wkno.org/ | |
41 | (r'video\.lpb\.org', 'LPB/LOUISIANA PUBLIC BROADCASTING (WLPB)'), # http://www.lpb.org/ | |
42 | (r'videos\.oeta\.tv', 'OETA (KETA)'), # http://www.oeta.tv | |
43 | (r'video\.optv\.org', 'Ozarks Public Television (KOZK)'), # http://www.optv.org/ | |
44 | (r'watch\.wsiu\.org', 'WSIU Public Broadcasting (WSIU)'), # http://www.wsiu.org/ | |
45 | (r'video\.keet\.org', 'KEET TV (KEET)'), # http://www.keet.org | |
46 | (r'pbs\.kixe\.org', 'KIXE/Channel 9 (KIXE)'), # http://kixe.org/ | |
47 | (r'video\.kpbs\.org', 'KPBS San Diego (KPBS)'), # http://www.kpbs.org/ | |
48 | (r'video\.kqed\.org', 'KQED (KQED)'), # http://www.kqed.org | |
49 | (r'vids\.kvie\.org', 'KVIE Public Television (KVIE)'), # http://www.kvie.org | |
50 | (r'video\.pbssocal\.org', 'PBS SoCal/KOCE (KOCE)'), # http://www.pbssocal.org/ | |
51 | (r'video\.valleypbs\.org', 'ValleyPBS (KVPT)'), # http://www.valleypbs.org/ | |
52 | (r'video\.cptv\.org', 'CONNECTICUT PUBLIC TELEVISION (WEDH)'), # http://cptv.org | |
53 | (r'watch\.knpb\.org', 'KNPB Channel 5 (KNPB)'), # http://www.knpb.org/ | |
54 | (r'video\.soptv\.org', 'SOPTV (KSYS)'), # http://www.soptv.org | |
55 | # (r'klcs\.org', 'KLCS/Channel 58 (KLCS)'), # http://www.klcs.org | |
56 | # (r'krcb\.org', 'KRCB Television & Radio (KRCB)'), # http://www.krcb.org | |
57 | # (r'kvcr\.org', 'KVCR TV/DT/FM :: Vision for the Future (KVCR)'), # http://kvcr.org | |
58 | (r'video\.rmpbs\.org', 'Rocky Mountain PBS (KRMA)'), # http://www.rmpbs.org | |
59 | (r'video\.kenw\.org', 'KENW-TV3 (KENW)'), # http://www.kenw.org | |
60 | (r'video\.kued\.org', 'KUED Channel 7 (KUED)'), # http://www.kued.org | |
61 | (r'video\.wyomingpbs\.org', 'Wyoming PBS (KCWC)'), # http://www.wyomingpbs.org | |
62 | (r'video\.cpt12\.org', 'Colorado Public Television / KBDI 12 (KBDI)'), # http://www.cpt12.org/ | |
63 | (r'video\.kbyueleven\.org', 'KBYU-TV (KBYU)'), # http://www.kbyutv.org/ | |
64 | (r'video\.thirteen\.org', 'Thirteen/WNET New York (WNET)'), # http://www.thirteen.org | |
65 | (r'video\.wgbh\.org', 'WGBH/Channel 2 (WGBH)'), # http://wgbh.org | |
66 | (r'video\.wgby\.org', 'WGBY (WGBY)'), # http://www.wgby.org | |
67 | (r'watch\.njtvonline\.org', 'NJTV Public Media NJ (WNJT)'), # http://www.njtvonline.org/ | |
68 | # (r'ripbs\.org', 'Rhode Island PBS (WSBE)'), # http://www.ripbs.org/home/ | |
69 | (r'watch\.wliw\.org', 'WLIW21 (WLIW)'), # http://www.wliw.org/ | |
70 | (r'video\.mpt\.tv', 'mpt/Maryland Public Television (WMPB)'), # http://www.mpt.org | |
71 | (r'watch\.weta\.org', 'WETA Television and Radio (WETA)'), # http://www.weta.org | |
72 | (r'video\.whyy\.org', 'WHYY (WHYY)'), # http://www.whyy.org | |
73 | (r'video\.wlvt\.org', 'PBS 39 (WLVT)'), # http://www.wlvt.org/ | |
74 | (r'video\.wvpt\.net', 'WVPT - Your Source for PBS and More! (WVPT)'), # http://www.wvpt.net | |
75 | (r'video\.whut\.org', 'Howard University Television (WHUT)'), # http://www.whut.org | |
76 | (r'video\.wedu\.org', 'WEDU PBS (WEDU)'), # http://www.wedu.org | |
77 | (r'video\.wgcu\.org', 'WGCU Public Media (WGCU)'), # http://www.wgcu.org/ | |
78 | # (r'wjct\.org', 'WJCT Public Broadcasting (WJCT)'), # http://www.wjct.org | |
79 | (r'video\.wpbt2\.org', 'WPBT2 (WPBT)'), # http://www.wpbt2.org | |
80 | (r'video\.wucftv\.org', 'WUCF TV (WUCF)'), # http://wucftv.org | |
81 | (r'video\.wuft\.org', 'WUFT/Channel 5 (WUFT)'), # http://www.wuft.org | |
82 | (r'watch\.wxel\.org', 'WXEL/Channel 42 (WXEL)'), # http://www.wxel.org/home/ | |
83 | (r'video\.wlrn\.org', 'WLRN/Channel 17 (WLRN)'), # http://www.wlrn.org/ | |
84 | (r'video\.wusf\.usf\.edu', 'WUSF Public Broadcasting (WUSF)'), # http://wusf.org/ | |
85 | (r'video\.scetv\.org', 'ETV (WRLK)'), # http://www.scetv.org | |
86 | (r'video\.unctv\.org', 'UNC-TV (WUNC)'), # http://www.unctv.org/ | |
87 | # (r'pbsguam\.org', 'PBS Guam (KGTF)'), # http://www.pbsguam.org/ | |
88 | (r'video\.pbshawaii\.org', 'PBS Hawaii - Oceanic Cable Channel 10 (KHET)'), # http://www.pbshawaii.org/ | |
89 | (r'video\.idahoptv\.org', 'Idaho Public Television (KAID)'), # http://idahoptv.org | |
90 | (r'video\.ksps\.org', 'KSPS (KSPS)'), # http://www.ksps.org/home/ | |
91 | (r'watch\.opb\.org', 'OPB (KOPB)'), # http://www.opb.org | |
92 | (r'watch\.nwptv\.org', 'KWSU/Channel 10 & KTNW/Channel 31 (KWSU)'), # http://www.kwsu.org | |
93 | (r'video\.will\.illinois\.edu', 'WILL-TV (WILL)'), # http://will.illinois.edu/ | |
94 | (r'video\.networkknowledge\.tv', 'Network Knowledge - WSEC/Springfield (WSEC)'), # http://www.wsec.tv | |
95 | (r'video\.wttw\.com', 'WTTW11 (WTTW)'), # http://www.wttw.com/ | |
96 | # (r'wtvp\.org', 'WTVP & WTVP.org, Public Media for Central Illinois (WTVP)'), # http://www.wtvp.org/ | |
97 | (r'video\.iptv\.org', 'Iowa Public Television/IPTV (KDIN)'), # http://www.iptv.org/ | |
98 | (r'video\.ninenet\.org', 'Nine Network (KETC)'), # http://www.ninenet.org | |
99 | (r'video\.wfwa\.org', 'PBS39 Fort Wayne (WFWA)'), # http://wfwa.org/ | |
100 | (r'video\.wfyi\.org', 'WFYI Indianapolis (WFYI)'), # http://www.wfyi.org | |
101 | (r'video\.mptv\.org', 'Milwaukee Public Television (WMVS)'), # http://www.mptv.org | |
102 | (r'video\.wnin\.org', 'WNIN (WNIN)'), # http://www.wnin.org/ | |
103 | (r'video\.wnit\.org', 'WNIT Public Television (WNIT)'), # http://www.wnit.org/ | |
104 | (r'video\.wpt\.org', 'WPT (WPNE)'), # http://www.wpt.org/ | |
105 | (r'video\.wvut\.org', 'WVUT/Channel 22 (WVUT)'), # http://wvut.org/ | |
106 | (r'video\.weiu\.net', 'WEIU/Channel 51 (WEIU)'), # http://www.weiu.net | |
107 | (r'video\.wqpt\.org', 'WQPT-TV (WQPT)'), # http://www.wqpt.org | |
108 | (r'video\.wycc\.org', 'WYCC PBS Chicago (WYCC)'), # http://www.wycc.org | |
109 | # (r'lakeshorepublicmedia\.org', 'Lakeshore Public Television (WYIN)'), # http://lakeshorepublicmedia.org/ | |
110 | (r'video\.wipb\.org', 'WIPB-TV (WIPB)'), # http://wipb.org | |
111 | (r'video\.indianapublicmedia\.org', 'WTIU (WTIU)'), # http://indianapublicmedia.org/tv/ | |
112 | (r'watch\.cetconnect\.org', 'CET (WCET)'), # http://www.cetconnect.org | |
113 | (r'video\.thinktv\.org', 'ThinkTVNetwork (WPTD)'), # http://www.thinktv.org | |
114 | (r'video\.wbgu\.org', 'WBGU-TV (WBGU)'), # http://wbgu.org | |
115 | (r'video\.wgvu\.org', 'WGVU TV (WGVU)'), # http://www.wgvu.org/ | |
116 | (r'video\.netnebraska\.org', 'NET1 (KUON)'), # http://netnebraska.org | |
117 | (r'video\.pioneer\.org', 'Pioneer Public Television (KWCM)'), # http://www.pioneer.org | |
118 | (r'watch\.sdpb\.org', 'SDPB Television (KUSD)'), # http://www.sdpb.org | |
119 | (r'video\.tpt\.org', 'TPT (KTCA)'), # http://www.tpt.org | |
120 | (r'watch\.ksmq\.org', 'KSMQ (KSMQ)'), # http://www.ksmq.org/ | |
121 | (r'watch\.kpts\.org', 'KPTS/Channel 8 (KPTS)'), # http://www.kpts.org/ | |
122 | (r'watch\.ktwu\.org', 'KTWU/Channel 11 (KTWU)'), # http://ktwu.org | |
123 | # (r'shptv\.org', 'Smoky Hills Public Television (KOOD)'), # http://www.shptv.org | |
124 | # (r'kcpt\.org', 'KCPT Kansas City Public Television (KCPT)'), # http://kcpt.org/ | |
125 | # (r'blueridgepbs\.org', 'Blue Ridge PBS (WBRA)'), # http://www.blueridgepbs.org/ | |
126 | (r'watch\.easttennesseepbs\.org', 'East Tennessee PBS (WSJK)'), # http://easttennesseepbs.org | |
127 | (r'video\.wcte\.tv', 'WCTE-TV (WCTE)'), # http://www.wcte.org | |
128 | (r'video\.wljt\.org', 'WLJT, Channel 11 (WLJT)'), # http://wljt.org/ | |
129 | (r'video\.wosu\.org', 'WOSU TV (WOSU)'), # http://wosu.org/ | |
130 | (r'video\.woub\.org', 'WOUB/WOUC (WOUB)'), # http://woub.org/tv/index.php?section=5 | |
131 | (r'video\.wvpublic\.org', 'WVPB (WVPB)'), # http://wvpublic.org/ | |
132 | (r'video\.wkyupbs\.org', 'WKYU-PBS (WKYU)'), # http://www.wkyupbs.org | |
133 | # (r'wyes\.org', 'WYES-TV/New Orleans (WYES)'), # http://www.wyes.org | |
134 | (r'video\.kera\.org', 'KERA 13 (KERA)'), # http://www.kera.org/ | |
135 | (r'video\.mpbn\.net', 'MPBN (WCBB)'), # http://www.mpbn.net/ | |
136 | (r'video\.mountainlake\.org', 'Mountain Lake PBS (WCFE)'), # http://www.mountainlake.org/ | |
137 | (r'video\.nhptv\.org', 'NHPTV (WENH)'), # http://nhptv.org/ | |
138 | (r'video\.vpt\.org', 'Vermont PBS (WETK)'), # http://www.vpt.org | |
139 | (r'video\.witf\.org', 'witf (WITF)'), # http://www.witf.org | |
140 | (r'watch\.wqed\.org', 'WQED Multimedia (WQED)'), # http://www.wqed.org/ | |
141 | (r'video\.wmht\.org', 'WMHT Educational Telecommunications (WMHT)'), # http://www.wmht.org/home/ | |
142 | (r'video\.deltabroadcasting\.org', 'Q-TV (WDCQ)'), # http://www.deltabroadcasting.org | |
143 | (r'video\.dptv\.org', 'WTVS Detroit Public TV (WTVS)'), # http://www.dptv.org/ | |
144 | (r'video\.wcmu\.org', 'CMU Public Television (WCMU)'), # http://www.wcmu.org | |
145 | (r'video\.wkar\.org', 'WKAR-TV (WKAR)'), # http://wkar.org/ | |
146 | (r'wnmuvideo\.nmu\.edu', 'WNMU-TV Public TV 13 (WNMU)'), # http://wnmutv.nmu.edu | |
147 | (r'video\.wdse\.org', 'WDSE - WRPT (WDSE)'), # http://www.wdse.org/ | |
148 | (r'video\.wgte\.org', 'WGTE TV (WGTE)'), # http://www.wgte.org | |
149 | (r'video\.lptv\.org', 'Lakeland Public Television (KAWE)'), # http://www.lakelandptv.org | |
150 | # (r'prairiepublic\.org', 'PRAIRIE PUBLIC (KFME)'), # http://www.prairiepublic.org/ | |
151 | (r'video\.kmos\.org', 'KMOS-TV - Channels 6.1, 6.2 and 6.3 (KMOS)'), # http://www.kmos.org/ | |
152 | (r'watch\.montanapbs\.org', 'MontanaPBS (KUSM)'), # http://montanapbs.org | |
153 | (r'video\.krwg\.org', 'KRWG/Channel 22 (KRWG)'), # http://www.krwg.org | |
154 | (r'video\.kacvtv\.org', 'KACV (KACV)'), # http://www.panhandlepbs.org/home/ | |
155 | (r'video\.kcostv\.org', 'KCOS/Channel 13 (KCOS)'), # www.kcostv.org | |
156 | (r'video\.wcny\.org', 'WCNY/Channel 24 (WCNY)'), # http://www.wcny.org | |
157 | (r'video\.wned\.org', 'WNED (WNED)'), # http://www.wned.org/ | |
158 | (r'watch\.wpbstv\.org', 'WPBS (WPBS)'), # http://www.wpbstv.org | |
159 | (r'video\.wskg\.org', 'WSKG Public TV (WSKG)'), # http://wskg.org | |
160 | (r'video\.wxxi\.org', 'WXXI (WXXI)'), # http://wxxi.org | |
161 | (r'video\.wpsu\.org', 'WPSU (WPSU)'), # http://www.wpsu.org | |
162 | # (r'wqln\.org', 'WQLN/Channel 54 (WQLN)'), # http://www.wqln.org | |
163 | (r'on-demand\.wvia\.org', 'WVIA Public Media Studios (WVIA)'), # http://www.wvia.org/ | |
164 | (r'video\.wtvi\.org', 'WTVI (WTVI)'), # http://www.wtvi.org/ | |
165 | # (r'whro\.org', 'WHRO (WHRO)'), # http://whro.org | |
166 | (r'video\.westernreservepublicmedia\.org', 'Western Reserve PBS (WNEO)'), # http://www.WesternReservePublicMedia.org/ | |
167 | (r'video\.ideastream\.org', 'WVIZ/PBS ideastream (WVIZ)'), # http://www.wviz.org/ | |
168 | (r'video\.kcts9\.org', 'KCTS 9 (KCTS)'), # http://kcts9.org/ | |
169 | (r'video\.basinpbs\.org', 'Basin PBS (KPBT)'), # http://www.basinpbs.org | |
170 | (r'video\.houstonpbs\.org', 'KUHT / Channel 8 (KUHT)'), # http://www.houstonpublicmedia.org/ | |
171 | # (r'tamu\.edu', 'KAMU - TV (KAMU)'), # http://KAMU.tamu.edu | |
172 | # (r'kedt\.org', 'KEDT/Channel 16 (KEDT)'), # http://www.kedt.org | |
173 | (r'video\.klrn\.org', 'KLRN (KLRN)'), # http://www.klrn.org | |
174 | (r'video\.klru\.tv', 'KLRU (KLRU)'), # http://www.klru.org | |
175 | # (r'kmbh\.org', 'KMBH-TV (KMBH)'), # http://www.kmbh.org | |
176 | # (r'knct\.org', 'KNCT (KNCT)'), # http://www.knct.org | |
177 | # (r'ktxt\.org', 'KTTZ-TV (KTXT)'), # http://www.ktxt.org | |
178 | (r'video\.wtjx\.org', 'WTJX Channel 12 (WTJX)'), # http://www.wtjx.org/ | |
179 | (r'video\.ideastations\.org', 'WCVE PBS (WCVE)'), # http://ideastations.org/ | |
180 | (r'video\.kbtc\.org', 'KBTC Public Television (KBTC)'), # http://kbtc.org | |
e15e2ef7 S |
181 | ) |
182 | ||
183 | IE_NAME = 'pbs' | |
184 | IE_DESC = 'Public Broadcasting Service (PBS) and member stations: %s' % ', '.join(list(zip(*_STATIONS))[1]) | |
185 | ||
22e7f1a6 PH |
186 | _VALID_URL = r'''(?x)https?:// |
187 | (?: | |
27aede90 | 188 | # Direct video URL |
6b9cbd02 | 189 | (?:%s)/(?:(?:vir|port)alplayer|video)/(?P<id>[0-9]+)(?:[?/]|$) | |
27aede90 | 190 | # Article with embedded player (or direct video) |
183062a4 | 191 | (?:www\.)?pbs\.org/(?:[^/]+/){1,5}(?P<presumptive_id>[^/]+?)(?:\.html)?/?(?:$|[?\#]) | |
22e7f1a6 | 192 | # Player |
9222c381 | 193 | (?:video|player)\.pbs\.org/(?:widget/)?partnerplayer/(?P<player_id>[^/]+) |
22e7f1a6 | 194 | ) |
8f0afda0 | 195 | ''' % '|'.join(list(zip(*_STATIONS))[0]) |
9779b63b | 196 | |
4248dad9 S |
197 | _GEO_COUNTRIES = ['US'] |
198 | ||
4d9bd478 S |
199 | _TESTS = [ |
200 | { | |
201 | 'url': 'http://www.pbs.org/tpt/constitution-usa-peter-sagal/watch/a-more-perfect-union/', | |
cbc032c8 | 202 | 'md5': '173dc391afd361fa72eab5d3d918968d', |
4d9bd478 S |
203 | 'info_dict': { |
204 | 'id': '2365006249', | |
205 | 'ext': 'mp4', | |
a5dd9a0c | 206 | 'title': 'Constitution USA with Peter Sagal - A More Perfect Union', |
542130a5 | 207 | 'description': 'md5:31b664af3c65fd07fa460d306b837d00', |
4d9bd478 S |
208 | 'duration': 3190, |
209 | }, | |
9779b63b | 210 | }, |
cd6b4836 S |
211 | { |
212 | 'url': 'http://www.pbs.org/wgbh/pages/frontline/losing-iraq/', | |
cbc032c8 | 213 | 'md5': '6f722cb3c3982186d34b0f13374499c7', |
cd6b4836 S |
214 | 'info_dict': { |
215 | 'id': '2365297690', | |
216 | 'ext': 'mp4', | |
a5dd9a0c | 217 | 'title': 'FRONTLINE - Losing Iraq', |
542130a5 | 218 | 'description': 'md5:5979a4d069b157f622d02bff62fbe654', |
cd6b4836 S |
219 | 'duration': 5050, |
220 | }, | |
221 | }, | |
4d9bd478 S |
222 | { |
223 | 'url': 'http://www.pbs.org/newshour/bb/education-jan-june12-cyberschools_02-23/', | |
224 | 'md5': 'b19856d7f5351b17a5ab1dc6a64be633', | |
225 | 'info_dict': { | |
226 | 'id': '2201174722', | |
227 | 'ext': 'mp4', | |
a5dd9a0c | 228 | 'title': 'PBS NewsHour - Cyber Schools Gain Popularity, but Quality Questions Persist', |
542130a5 | 229 | 'description': 'md5:86ab9a3d04458b876147b355788b8781', |
4d9bd478 S |
230 | 'duration': 801, |
231 | }, | |
232 | }, | |
756b046f PH |
233 | { |
234 | 'url': 'http://www.pbs.org/wnet/gperf/dudamel-conducts-verdi-requiem-hollywood-bowl-full-episode/3374/', | |
235 | 'md5': 'c62859342be2a0358d6c9eb306595978', | |
236 | 'info_dict': { | |
237 | 'id': '2365297708', | |
238 | 'ext': 'mp4', | |
a5dd9a0c | 239 | 'title': 'Great Performances - Dudamel Conducts Verdi Requiem at the Hollywood Bowl - Full', |
a7ab4637 | 240 | 'description': 'md5:657897370e09e2bc6bf0f8d2cd313c6b', |
756b046f | 241 | 'duration': 6559, |
ec85ded8 | 242 | 'thumbnail': r're:^https?://.*\.jpg$', |
5b61070c | 243 | }, |
27aede90 PH |
244 | }, |
245 | { | |
246 | 'url': 'http://www.pbs.org/wgbh/nova/earth/killer-typhoon.html', | |
247 | 'md5': '908f3e5473a693b266b84e25e1cf9703', | |
248 | 'info_dict': { | |
249 | 'id': '2365160389', | |
250 | 'display_id': 'killer-typhoon', | |
251 | 'ext': 'mp4', | |
252 | 'description': 'md5:c741d14e979fc53228c575894094f157', | |
a5dd9a0c | 253 | 'title': 'NOVA - Killer Typhoon', |
27aede90 | 254 | 'duration': 3172, |
ec85ded8 | 255 | 'thumbnail': r're:^https?://.*\.jpg$', |
27aede90 | 256 | 'upload_date': '20140122', |
fb0d12c6 | 257 | 'age_limit': 10, |
5b61070c | 258 | }, |
9bbec552 S |
259 | }, |
260 | { | |
261 | 'url': 'http://www.pbs.org/wgbh/pages/frontline/united-states-of-secrets/', | |
262 | 'info_dict': { | |
263 | 'id': 'united-states-of-secrets', | |
264 | }, | |
265 | 'playlist_count': 2, | |
dbe1a935 | 266 | }, |
4947f13c S |
267 | { |
268 | 'url': 'http://www.pbs.org/wgbh/americanexperience/films/great-war/', | |
269 | 'info_dict': { | |
270 | 'id': 'great-war', | |
271 | }, | |
272 | 'playlist_count': 3, | |
273 | }, | |
dbe1a935 YCH |
274 | { |
275 | 'url': 'http://www.pbs.org/wgbh/americanexperience/films/death/player/', | |
276 | 'info_dict': { | |
7faf7e75 | 277 | 'id': '2276541483', |
dbe1a935 YCH |
278 | 'display_id': 'player', |
279 | 'ext': 'mp4', | |
7faf7e75 | 280 | 'title': 'American Experience - Death and the Civil War, Chapter 1', |
542130a5 | 281 | 'description': 'md5:67fa89a9402e2ee7d08f53b920674c18', |
7faf7e75 | 282 | 'duration': 682, |
ec85ded8 | 283 | 'thumbnail': r're:^https?://.*\.jpg$', |
dbe1a935 YCH |
284 | }, |
285 | 'params': { | |
286 | 'skip_download': True, # requires ffmpeg | |
5b61070c | 287 | }, |
a5dd9a0c | 288 | }, |
289 | { | |
a7ab4637 | 290 | 'url': 'http://www.pbs.org/video/2365245528/', |
cbc032c8 | 291 | 'md5': '115223d41bd55cda8ae5cd5ed4e11497', |
a5dd9a0c | 292 | 'info_dict': { |
a7ab4637 S |
293 | 'id': '2365245528', |
294 | 'display_id': '2365245528', | |
a5dd9a0c | 295 | 'ext': 'mp4', |
a7ab4637 S |
296 | 'title': 'FRONTLINE - United States of Secrets (Part One)', |
297 | 'description': 'md5:55756bd5c551519cc4b7703e373e217e', | |
298 | 'duration': 6851, | |
ec85ded8 | 299 | 'thumbnail': r're:^https?://.*\.jpg$', |
a5dd9a0c | 300 | }, |
90ab741e S |
301 | }, |
302 | { | |
303 | # Video embedded in iframe containing angle brackets as attribute's value (e.g. | |
304 | # "<iframe style='position: absolute;<br />\ntop: 0; left: 0;' ...", see | |
067aa17e | 305 | # https://github.com/ytdl-org/youtube-dl/issues/7059) |
90ab741e | 306 | 'url': 'http://www.pbs.org/food/features/a-chefs-life-season-3-episode-5-prickly-business/', |
542130a5 | 307 | 'md5': '59b0ef5009f9ac8a319cc5efebcd865e', |
90ab741e S |
308 | 'info_dict': { |
309 | 'id': '2365546844', | |
310 | 'display_id': 'a-chefs-life-season-3-episode-5-prickly-business', | |
311 | 'ext': 'mp4', | |
312 | 'title': "A Chef's Life - Season 3, Ep. 5: Prickly Business", | |
542130a5 | 313 | 'description': 'md5:c0ff7475a4b70261c7e58f493c2792a5', |
90ab741e | 314 | 'duration': 1480, |
ec85ded8 | 315 | 'thumbnail': r're:^https?://.*\.jpg$', |
90ab741e | 316 | }, |
8b6d9406 S |
317 | }, |
318 | { | |
319 | # Frontline video embedded via flp2012.js | |
320 | 'url': 'http://www.pbs.org/wgbh/pages/frontline/the-atomic-artists', | |
321 | 'info_dict': { | |
322 | 'id': '2070868960', | |
323 | 'display_id': 'the-atomic-artists', | |
324 | 'ext': 'mp4', | |
325 | 'title': 'FRONTLINE - The Atomic Artists', | |
542130a5 | 326 | 'description': 'md5:f677e4520cfacb4a5ce1471e31b57800', |
8b6d9406 | 327 | 'duration': 723, |
ec85ded8 | 328 | 'thumbnail': r're:^https?://.*\.jpg$', |
8b6d9406 S |
329 | }, |
330 | 'params': { | |
331 | 'skip_download': True, # requires ffmpeg | |
332 | }, | |
312a3f38 | 333 | }, |
5d6e1011 S |
334 | { |
335 | # Serves hd only via wigget/partnerplayer page | |
336 | 'url': 'http://www.pbs.org/video/2365641075/', | |
542130a5 | 337 | 'md5': 'fdf907851eab57211dd589cf12006666', |
5d6e1011 S |
338 | 'info_dict': { |
339 | 'id': '2365641075', | |
340 | 'ext': 'mp4', | |
341 | 'title': 'FRONTLINE - Netanyahu at War', | |
342 | 'duration': 6852, | |
ec85ded8 | 343 | 'thumbnail': r're:^https?://.*\.jpg$', |
5d6e1011 S |
344 | 'formats': 'mincount:8', |
345 | }, | |
5d6e1011 | 346 | }, |
183062a4 | 347 | { |
067aa17e | 348 | # https://github.com/ytdl-org/youtube-dl/issues/13801 |
183062a4 S |
349 | 'url': 'https://www.pbs.org/video/pbs-newshour-full-episode-july-31-2017-1501539057/', |
350 | 'info_dict': { | |
351 | 'id': '3003333873', | |
352 | 'ext': 'mp4', | |
353 | 'title': 'PBS NewsHour - full episode July 31, 2017', | |
354 | 'description': 'md5:d41d8cd98f00b204e9800998ecf8427e', | |
355 | 'duration': 3265, | |
356 | 'thumbnail': r're:^https?://.*\.jpg$', | |
357 | }, | |
358 | 'params': { | |
359 | 'skip_download': True, | |
360 | }, | |
361 | }, | |
d7be7053 S |
362 | { |
363 | 'url': 'http://www.pbs.org/wgbh/roadshow/watch/episode/2105-indianapolis-hour-2/', | |
364 | 'info_dict': { | |
365 | 'id': '2365936247', | |
366 | 'ext': 'mp4', | |
367 | 'title': 'Antiques Roadshow - Indianapolis, Hour 2', | |
368 | 'description': 'md5:524b32249db55663e7231b6b8d1671a2', | |
369 | 'duration': 3180, | |
370 | 'thumbnail': r're:^https?://.*\.jpg$', | |
371 | }, | |
372 | 'params': { | |
373 | 'skip_download': True, | |
374 | }, | |
375 | 'expected_warnings': ['HTTP Error 403: Forbidden'], | |
376 | }, | |
87f89dac S |
377 | { |
378 | 'url': 'https://www.pbs.org/wgbh/masterpiece/episodes/victoria-s2-e1/', | |
379 | 'info_dict': { | |
380 | 'id': '3007193718', | |
381 | 'ext': 'mp4', | |
382 | 'title': "Victoria - A Soldier's Daughter / The Green-Eyed Monster", | |
383 | 'description': 'md5:37efbac85e0c09b009586523ec143652', | |
384 | 'duration': 6292, | |
385 | 'thumbnail': r're:^https?://.*\.(?:jpg|JPG)$', | |
386 | }, | |
387 | 'params': { | |
388 | 'skip_download': True, | |
389 | }, | |
390 | 'expected_warnings': ['HTTP Error 403: Forbidden'], | |
391 | }, | |
392 | { | |
393 | 'url': 'https://player.pbs.org/partnerplayer/tOz9tM5ljOXQqIIWke53UA==/', | |
394 | 'info_dict': { | |
395 | 'id': '3011407934', | |
396 | 'ext': 'mp4', | |
397 | 'title': 'Stories from the Stage - Road Trip', | |
398 | 'duration': 1619, | |
399 | 'thumbnail': r're:^https?://.*\.(?:jpg|JPG)$', | |
400 | }, | |
401 | 'params': { | |
402 | 'skip_download': True, | |
403 | }, | |
404 | 'expected_warnings': ['HTTP Error 403: Forbidden'], | |
405 | }, | |
312a3f38 S |
406 | { |
407 | 'url': 'http://player.pbs.org/widget/partnerplayer/2365297708/?start=0&end=0&chapterbar=false&endscreen=false&topbar=true', | |
408 | 'only_matching': True, | |
612d83b5 S |
409 | }, |
410 | { | |
411 | 'url': 'http://watch.knpb.org/video/2365616055/', | |
412 | 'only_matching': True, | |
6b9cbd02 RA |
413 | }, |
414 | { | |
415 | 'url': 'https://player.pbs.org/portalplayer/3004638221/?uid=', | |
416 | 'only_matching': True, | |
756b046f | 417 | } |
4d9bd478 | 418 | ] |
0553d0ee | 419 | _ERRORS = { |
420 | 101: 'We\'re sorry, but this video is not yet available.', | |
421 | 403: 'We\'re sorry, but this video is not available in your region due to right restrictions.', | |
422 | 404: 'We are experiencing technical difficulties that are preventing us from playing the video at this time. Please check back again soon.', | |
423 | 410: 'This video has expired and is no longer available for online streaming.', | |
424 | } | |
9779b63b | 425 | |
5aaf012a RA |
426 | def _real_initialize(self): |
427 | cookie = (self._download_json( | |
428 | 'http://localization.services.pbs.org/localize/auto/cookie/', | |
429 | None, headers=self.geo_verification_headers(), fatal=False) or {}).get('cookie') | |
430 | if cookie: | |
431 | station = self._search_regex(r'#?s=\["([^"]+)"', cookie, 'station') | |
432 | if station: | |
433 | self._set_cookie('.pbs.org', 'pbsol.station', station) | |
434 | ||
27aede90 | 435 | def _extract_webpage(self, url): |
5ad28e7f | 436 | mobj = self._match_valid_url(url) |
22e7f1a6 | 437 | |
542130a5 S |
438 | description = None |
439 | ||
22e7f1a6 PH |
440 | presumptive_id = mobj.group('presumptive_id') |
441 | display_id = presumptive_id | |
442 | if presumptive_id: | |
443 | webpage = self._download_webpage(url, display_id) | |
8d7d9d34 | 444 | |
542130a5 S |
445 | description = strip_or_none(self._og_search_description( |
446 | webpage, default=None) or self._html_search_meta( | |
447 | 'description', webpage, default=None)) | |
27aede90 PH |
448 | upload_date = unified_strdate(self._search_regex( |
449 | r'<input type="hidden" id="air_date_[0-9]+" value="([^"]+)"', | |
450 | webpage, 'upload date', default=None)) | |
451 | ||
9bbec552 | 452 | # tabbed frontline videos |
6b3fbd34 S |
453 | MULTI_PART_REGEXES = ( |
454 | r'<div[^>]+class="videotab[^"]*"[^>]+vid="(\d+)"', | |
4947f13c | 455 | r'<a[^>]+href=["\']#(?:video-|part)\d+["\'][^>]+data-cove[Ii]d=["\'](\d+)', |
6b3fbd34 S |
456 | ) |
457 | for p in MULTI_PART_REGEXES: | |
4947f13c | 458 | tabbed_videos = orderedSet(re.findall(p, webpage)) |
6b3fbd34 | 459 | if tabbed_videos: |
542130a5 | 460 | return tabbed_videos, presumptive_id, upload_date, description |
9bbec552 | 461 | |
4d9bd478 S |
462 | MEDIA_ID_REGEXES = [ |
463 | r"div\s*:\s*'videoembed'\s*,\s*mediaid\s*:\s*'(\d+)'", # frontline video embed | |
464 | r'class="coveplayerid">([^<]+)<', # coveplayer | |
d0c8b279 | 465 | r'<section[^>]+data-coveid="(\d+)"', # coveplayer from http://www.pbs.org/wgbh/frontline/film/real-csi/ |
27aede90 | 466 | r'<input type="hidden" id="pbs_video_id_[0-9]+" value="([0-9]+)"/>', # jwplayer |
53f024e7 | 467 | r"(?s)window\.PBS\.playerConfig\s*=\s*{.*?id\s*:\s*'([0-9]+)',", |
d7be7053 | 468 | r'<div[^>]+\bdata-cove-id=["\'](\d+)"', # http://www.pbs.org/wgbh/roadshow/watch/episode/2105-indianapolis-hour-2/ |
87f89dac | 469 | r'<iframe[^>]+\bsrc=["\'](?:https?:)?//video\.pbs\.org/widget/partnerplayer/(\d+)', # https://www.pbs.org/wgbh/masterpiece/episodes/victoria-s2-e1/ |
4d9bd478 S |
470 | ] |
471 | ||
8d7d9d34 | 472 | media_id = self._search_regex( |
4d9bd478 | 473 | MEDIA_ID_REGEXES, webpage, 'media ID', fatal=False, default=None) |
8d7d9d34 | 474 | if media_id: |
542130a5 | 475 | return media_id, presumptive_id, upload_date, description |
8d7d9d34 | 476 | |
a0566bbf | 477 | # Frontline video embedded via flp |
686f9881 | 478 | video_id = self._search_regex( |
21d0c33e | 479 | r'videoid\s*:\s*"([\d+a-z]{7,})"', webpage, 'videoid', default=None) |
686f9881 S |
480 | if video_id: |
481 | # pkg_id calculation is reverse engineered from | |
482 | # http://www.pbs.org/wgbh/pages/frontline/js/flp2012.js | |
483 | prg_id = self._search_regex( | |
484 | r'videoid\s*:\s*"([\d+a-z]{7,})"', webpage, 'videoid')[7:] | |
485 | if 'q' in prg_id: | |
486 | prg_id = prg_id.split('q')[1] | |
487 | prg_id = int(prg_id, 16) | |
488 | getdir = self._download_json( | |
489 | 'http://www.pbs.org/wgbh/pages/frontline/.json/getdir/getdir%d.json' % prg_id, | |
490 | presumptive_id, 'Downloading getdir JSON', | |
491 | transform_source=strip_jsonp) | |
542130a5 | 492 | return getdir['mid'], presumptive_id, upload_date, description |
686f9881 | 493 | |
0fa6b17d S |
494 | for iframe in re.findall(r'(?s)<iframe(.+?)></iframe>', webpage): |
495 | url = self._search_regex( | |
496 | r'src=(["\'])(?P<url>.+?partnerplayer.+?)\1', iframe, | |
497 | 'player URL', default=None, group='url') | |
498 | if url: | |
499 | break | |
500 | ||
183062a4 S |
501 | if not url: |
502 | url = self._og_search_url(webpage) | |
503 | ||
87f89dac S |
504 | mobj = re.match( |
505 | self._VALID_URL, self._proto_relative_url(url.strip())) | |
22e7f1a6 PH |
506 | |
507 | player_id = mobj.group('player_id') | |
508 | if not display_id: | |
509 | display_id = player_id | |
510 | if player_id: | |
511 | player_page = self._download_webpage( | |
512 | url, display_id, note='Downloading player page', | |
513 | errnote='Could not download player page') | |
514 | video_id = self._search_regex( | |
87f89dac S |
515 | r'<div\s+id=["\']video_(\d+)', player_page, 'video ID', |
516 | default=None) | |
517 | if not video_id: | |
518 | video_info = self._extract_video_data( | |
519 | player_page, 'video data', display_id) | |
520 | video_id = compat_str( | |
521 | video_info.get('id') or video_info['contentID']) | |
22e7f1a6 PH |
522 | else: |
523 | video_id = mobj.group('id') | |
524 | display_id = video_id | |
525 | ||
542130a5 | 526 | return video_id, display_id, None, description |
8d7d9d34 | 527 | |
87f89dac S |
528 | def _extract_video_data(self, string, name, video_id, fatal=True): |
529 | return self._parse_json( | |
530 | self._search_regex( | |
531 | [r'(?s)PBS\.videoData\s*=\s*({.+?});\n', | |
532 | r'window\.videoBridge\s*=\s*({.+?});'], | |
533 | string, name, default='{}'), | |
534 | video_id, transform_source=js_to_json, fatal=fatal) | |
535 | ||
8d7d9d34 | 536 | def _real_extract(self, url): |
542130a5 | 537 | video_id, display_id, upload_date, description = self._extract_webpage(url) |
8d7d9d34 | 538 | |
9bbec552 S |
539 | if isinstance(video_id, list): |
540 | entries = [self.url_result( | |
541 | 'http://video.pbs.org/video/%s' % vid_id, 'PBS', vid_id) | |
542 | for vid_id in video_id] | |
543 | return self.playlist_result(entries, display_id) | |
544 | ||
baf599ef | 545 | info = {} |
5d6e1011 S |
546 | redirects = [] |
547 | redirect_urls = set() | |
548 | ||
549 | def extract_redirect_urls(info): | |
550 | for encoding_name in ('recommended_encoding', 'alternate_encoding'): | |
551 | redirect = info.get(encoding_name) | |
552 | if not redirect: | |
553 | continue | |
554 | redirect_url = redirect.get('url') | |
555 | if redirect_url and redirect_url not in redirect_urls: | |
556 | redirects.append(redirect) | |
557 | redirect_urls.add(redirect_url) | |
6f2d82a5 S |
558 | encodings = info.get('encodings') |
559 | if isinstance(encodings, list): | |
560 | for encoding in encodings: | |
561 | encoding_url = url_or_none(encoding) | |
562 | if encoding_url and encoding_url not in redirect_urls: | |
563 | redirects.append({'url': encoding_url}) | |
564 | redirect_urls.add(encoding_url) | |
5d6e1011 | 565 | |
7a6d33a9 | 566 | chapters = [] |
5d6e1011 S |
567 | # Player pages may also serve different qualities |
568 | for page in ('widget/partnerplayer', 'portalplayer'): | |
9a61dfba | 569 | player = self._download_webpage( |
5d6e1011 S |
570 | 'http://player.pbs.org/%s/%s' % (page, video_id), |
571 | display_id, 'Downloading %s page' % page, fatal=False) | |
572 | if player: | |
87f89dac S |
573 | video_info = self._extract_video_data( |
574 | player, '%s video data' % page, display_id, fatal=False) | |
5d6e1011 S |
575 | if video_info: |
576 | extract_redirect_urls(video_info) | |
577 | if not info: | |
578 | info = video_info | |
7a6d33a9 | 579 | if not chapters: |
eea2fafc RA |
580 | raw_chapters = video_info.get('chapters') or [] |
581 | if not raw_chapters: | |
582 | for chapter_data in re.findall(r'(?s)chapters\.push\(({.*?})\)', player): | |
583 | chapter = self._parse_json(chapter_data, video_id, js_to_json, fatal=False) | |
584 | if not chapter: | |
585 | continue | |
586 | raw_chapters.append(chapter) | |
587 | for chapter in raw_chapters: | |
7a6d33a9 | 588 | start_time = float_or_none(chapter.get('start_time'), 1000) |
589 | duration = float_or_none(chapter.get('duration'), 1000) | |
590 | if start_time is None or duration is None: | |
591 | continue | |
592 | chapters.append({ | |
593 | 'start_time': start_time, | |
594 | 'end_time': start_time + duration, | |
595 | 'title': chapter.get('title'), | |
596 | }) | |
5890eef6 S |
597 | |
598 | formats = [] | |
cbc032c8 | 599 | http_url = None |
a7e999be | 600 | hls_subs = {} |
5d6e1011 S |
601 | for num, redirect in enumerate(redirects): |
602 | redirect_id = redirect.get('eeid') | |
5890eef6 S |
603 | |
604 | redirect_info = self._download_json( | |
5d6e1011 | 605 | '%s?format=json' % redirect['url'], display_id, |
5aaf012a RA |
606 | 'Downloading %s video url info' % (redirect_id or num), |
607 | headers=self.geo_verification_headers()) | |
5890eef6 S |
608 | |
609 | if redirect_info['status'] == 'error': | |
8ab8066c S |
610 | message = self._ERRORS.get( |
611 | redirect_info['http_code'], redirect_info['message']) | |
612 | if redirect_info['http_code'] == 403: | |
4248dad9 S |
613 | self.raise_geo_restricted( |
614 | msg=message, countries=self._GEO_COUNTRIES) | |
9d5fb3b5 | 615 | raise ExtractorError( |
8ab8066c | 616 | '%s said: %s' % (self.IE_NAME, message), expected=True) |
5890eef6 S |
617 | |
618 | format_url = redirect_info.get('url') | |
619 | if not format_url: | |
620 | continue | |
621 | ||
622 | if determine_ext(format_url) == 'm3u8': | |
a7e999be | 623 | hls_formats, hls_subs = self._extract_m3u8_formats_and_subtitles( |
624 | format_url, display_id, 'mp4', m3u8_id='hls', fatal=False) | |
625 | formats.extend(hls_formats) | |
f86d543e | 626 | else: |
5890eef6 S |
627 | formats.append({ |
628 | 'url': format_url, | |
5d6e1011 | 629 | 'format_id': redirect_id, |
5890eef6 | 630 | }) |
cbc032c8 | 631 | if re.search(r'^https?://.*(?:\d+k|baseline)', format_url): |
632 | http_url = format_url | |
5d6e1011 | 633 | self._remove_duplicate_formats(formats) |
cbc032c8 | 634 | m3u8_formats = list(filter( |
ff99fe52 | 635 | lambda f: f.get('protocol') == 'm3u8' and f.get('vcodec') != 'none', |
cbc032c8 | 636 | formats)) |
637 | if http_url: | |
638 | for m3u8_format in m3u8_formats: | |
3cddb8d6 | 639 | bitrate = self._search_regex(r'(\d+)k', m3u8_format['url'], 'bitrate', default=None) |
5ec5461e S |
640 | # Lower qualities (150k and 192k) are not available as HTTP formats (see [1]), |
641 | # we won't try extracting them. | |
642 | # Since summer 2016 higher quality formats (4500k and 6500k) are also available | |
643 | # albeit they are not documented in [2]. | |
067aa17e | 644 | # 1. https://github.com/ytdl-org/youtube-dl/commit/cbc032c8b70a038a69259378c92b4ba97b42d491#commitcomment-17313656 |
5ec5461e | 645 | # 2. https://projects.pbs.org/confluence/display/coveapi/COVE+Video+Specifications |
3cddb8d6 | 646 | if not bitrate or int(bitrate) < 400: |
cbc032c8 | 647 | continue |
3cddb8d6 | 648 | f_url = re.sub(r'\d+k|baseline', bitrate + 'k', http_url) |
8704778d S |
649 | # This may produce invalid links sometimes (e.g. |
650 | # http://www.pbs.org/wgbh/frontline/film/suicide-plan) | |
f50365e9 | 651 | if not self._is_valid_url(f_url, display_id, 'http-%sk video' % bitrate): |
8704778d | 652 | continue |
cbc032c8 | 653 | f = m3u8_format.copy() |
654 | f.update({ | |
8704778d | 655 | 'url': f_url, |
cbc032c8 | 656 | 'format_id': m3u8_format['format_id'].replace('hls', 'http'), |
657 | 'protocol': 'http', | |
658 | }) | |
659 | formats.append(f) | |
baf599ef | 660 | for f in formats: |
661 | if (f.get('format_note') or '').endswith(' AD'): # Audio description | |
662 | f['language_preference'] = -10 | |
f86d543e | 663 | |
a1a530b0 PH |
664 | rating_str = info.get('rating') |
665 | if rating_str is not None: | |
666 | rating_str = rating_str.rpartition('-')[2] | |
667 | age_limit = US_RATINGS.get(rating_str) | |
668 | ||
06a12933 | 669 | subtitles = {} |
a7e999be | 670 | captions = info.get('cc') or {} |
671 | for caption_url in captions.values(): | |
672 | subtitles.setdefault('en', []).append({ | |
673 | 'url': caption_url | |
674 | }) | |
675 | subtitles = self._merge_subtitles(subtitles, hls_subs) | |
06a12933 | 676 | |
ce1bafdc S |
677 | # info['title'] is often incomplete (e.g. 'Full Episode', 'Episode 5', etc) |
678 | # Try turning it to 'program - title' naming scheme if possible | |
0eacd2aa | 679 | alt_title = info.get('program', {}).get('title') |
680 | if alt_title: | |
ec85ded8 | 681 | info['title'] = alt_title + ' - ' + re.sub(r'^' + alt_title + r'[\s\-:]+', '', info['title']) |
a5dd9a0c | 682 | |
542130a5 S |
683 | description = info.get('description') or info.get( |
684 | 'program', {}).get('description') or description | |
685 | ||
22e7f1a6 PH |
686 | return { |
687 | 'id': video_id, | |
27aede90 | 688 | 'display_id': display_id, |
22e7f1a6 | 689 | 'title': info['title'], |
542130a5 | 690 | 'description': description, |
22e7f1a6 | 691 | 'thumbnail': info.get('image_url'), |
5890eef6 | 692 | 'duration': int_or_none(info.get('duration')), |
a1a530b0 | 693 | 'age_limit': age_limit, |
27aede90 | 694 | 'upload_date': upload_date, |
5890eef6 | 695 | 'formats': formats, |
06a12933 | 696 | 'subtitles': subtitles, |
7a6d33a9 | 697 | 'chapters': chapters, |
22e7f1a6 | 698 | } |