diff options
author | Sergey M․ <dstftw@gmail.com> | 2019-03-17 09:07:47 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2019-03-17 09:07:47 +0700 |
commit | 0dc41787af0fb011f01d88c1f2ecb686a8416df5 (patch) | |
tree | 42bdaecb36f30b6be28de42a5a94471d42f8c3db /youtube_dl/utils.py | |
parent | e5cfb779ea0814971324d693e02f8c4d4ca78600 (diff) |
[utils] Introduce parse_bitrate
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 630dab8eb..f2726a579 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1798,6 +1798,14 @@ def parse_resolution(s): return {} +def parse_bitrate(s): + if not isinstance(s, compat_str): + return + mobj = re.search(r'\b(\d+)\s*kbps', s) + if mobj: + return int(mobj.group(1)) + + def month_by_name(name, lang='en'): """ Return the number of a month by (locale-independently) English name """ |