Skip to content

Commit 6fece0a

Browse files
committed
[AENetworksBaseIE] Report missing show data instead of crash
1 parent 70ff013 commit 6fece0a

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

youtube_dl/extractor/aenetworks.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
ExtractorError,
99
GeoRestrictedError,
1010
int_or_none,
11+
remove_start,
12+
traverse_obj,
1113
update_url_query,
1214
urlencode_postdata,
1315
)
@@ -33,14 +35,17 @@ class AENetworksBaseIE(ThePlatformIE):
3335
}
3436

3537
def _extract_aen_smil(self, smil_url, video_id, auth=None):
36-
query = {'mbr': 'true'}
38+
query = {
39+
'mbr': 'true',
40+
'formats': 'M3U+none,MPEG-DASH+none,MPEG4,MP3',
41+
}
3742
if auth:
3843
query['auth'] = auth
3944
TP_SMIL_QUERY = [{
4045
'assetTypes': 'high_video_ak',
41-
'switch': 'hls_high_ak'
46+
'switch': 'hls_high_ak',
4247
}, {
43-
'assetTypes': 'high_video_s3'
48+
'assetTypes': 'high_video_s3',
4449
}, {
4550
'assetTypes': 'high_video_s3',
4651
'switch': 'hls_high_fastly',
@@ -75,7 +80,14 @@ def _extract_aetn_info(self, domain, filter_key, filter_value, url):
7580
requestor_id, brand = self._DOMAIN_MAP[domain]
7681
result = self._download_json(
7782
'https://feeds.video.aetnd.com/api/v2/%s/videos' % brand,
78-
filter_value, query={'filter[%s]' % filter_key: filter_value})['results'][0]
83+
filter_value, query={'filter[%s]' % filter_key: filter_value})
84+
result = traverse_obj(
85+
result, ('results',
86+
lambda k, v: k == 0 and v[filter_key] == filter_value),
87+
get_all=False)
88+
if not result:
89+
raise ExtractorError('Show not found in A&E feed (too new?)', expected=True,
90+
video_id=remove_start(filter_value, '/'))
7991
title = result['title']
8092
video_id = result['id']
8193
media_url = result['publicUrl']
@@ -126,7 +138,7 @@ class AENetworksIE(AENetworksBaseIE):
126138
'skip_download': True,
127139
},
128140
'add_ie': ['ThePlatform'],
129-
'skip': 'This video is only available for users of participating TV providers.',
141+
'skip': 'Geo-restricted - This content is not available in your location.'
130142
}, {
131143
'url': 'http://www.aetv.com/shows/duck-dynasty/season-9/episode-1',
132144
'info_dict': {
@@ -143,6 +155,7 @@ class AENetworksIE(AENetworksBaseIE):
143155
'skip_download': True,
144156
},
145157
'add_ie': ['ThePlatform'],
158+
'skip': 'This video is only available for users of participating TV providers.',
146159
}, {
147160
'url': 'http://www.fyi.tv/shows/tiny-house-nation/season-1/episode-8',
148161
'only_matching': True

0 commit comments

Comments
 (0)