~hackershohag/yt-dlp-ut/master

« back to all changes in this revision

Viewing changes to youtube_dl/extractor/aenetworks.py

  • Committer: dirkf
  • Date: 2023-03-14 16:23:20 UTC
  • Revision ID: git-v1:6fece0a96b3cd8677f5c1185a57c6e21403fcb44
[AENetworksBaseIE] Report missing show data instead of crash

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
    ExtractorError,
9
9
    GeoRestrictedError,
10
10
    int_or_none,
 
11
    remove_start,
 
12
    traverse_obj,
11
13
    update_url_query,
12
14
    urlencode_postdata,
13
15
)
33
35
    }
34
36
 
35
37
    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
        }
37
42
        if auth:
38
43
            query['auth'] = auth
39
44
        TP_SMIL_QUERY = [{
40
45
            'assetTypes': 'high_video_ak',
41
 
            'switch': 'hls_high_ak'
 
46
            'switch': 'hls_high_ak',
42
47
        }, {
43
 
            'assetTypes': 'high_video_s3'
 
48
            'assetTypes': 'high_video_s3',
44
49
        }, {
45
50
            'assetTypes': 'high_video_s3',
46
51
            'switch': 'hls_high_fastly',
75
80
        requestor_id, brand = self._DOMAIN_MAP[domain]
76
81
        result = self._download_json(
77
82
            '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, '/'))
79
91
        title = result['title']
80
92
        video_id = result['id']
81
93
        media_url = result['publicUrl']
126
138
            'skip_download': True,
127
139
        },
128
140
        '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.'
130
142
    }, {
131
143
        'url': 'http://www.aetv.com/shows/duck-dynasty/season-9/episode-1',
132
144
        'info_dict': {
143
155
            'skip_download': True,
144
156
        },
145
157
        'add_ie': ['ThePlatform'],
 
158
        'skip': 'This video is only available for users of participating TV providers.',
146
159
    }, {
147
160
        'url': 'http://www.fyi.tv/shows/tiny-house-nation/season-1/episode-8',
148
161
        'only_matching': True