Skip to content

Commit

Permalink
[la7] using genarate_filesize method
Browse files Browse the repository at this point in the history
  • Loading branch information
nixxo committed Nov 9, 2021
1 parent 7577ec6 commit 329b800
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions yt_dlp/extractor/la7.py
Expand Up @@ -7,8 +7,6 @@
from ..utils import (
determine_ext,
float_or_none,
HEADRequest,
int_or_none,
parse_duration,
unified_strdate,
)
Expand Down Expand Up @@ -44,20 +42,15 @@ def _generate_mp4_url(self, quality, m3u8_formats):
if f['vcodec'] != 'none' and quality in f['url']:
http_url = '%s%s.mp4' % (self._HOST, quality)

urlh = self._request_webpage(
HEADRequest(http_url), quality,
note='Check filesize', fatal=False)
if urlh:
http_f = f.copy()
del http_f['manifest_url']
http_f.update({
'format_id': http_f['format_id'].replace('hls-', 'https-'),
'url': http_url,
'protocol': 'https',
'filesize_approx': int_or_none(urlh.headers.get('Content-Length', None)),
})
return http_f
return None
http_f = f.copy()
del http_f['manifest_url']
http_f.update({
'format_id': http_f['format_id'].replace('hls-', 'https-'),
'url': http_url,
'protocol': 'https',
'filesize_approx': self._generate_filesize(http_url, quality),
})
return http_f

def _real_extract(self, url):
video_id = self._match_id(url)
Expand Down

0 comments on commit 329b800

Please sign in to comment.