diff options
| author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2016-03-18 19:18:55 +0100 | 
|---|---|---|
| committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2016-03-18 19:23:06 +0100 | 
| commit | 09fc33198a4cfc93a98ce1ba7d51d41c487e5f56 (patch) | |
| tree | d0f0286ee92d826d2c0fd76e1bbd8e564c3211dc | |
| parent | 4c3b16d5d1bf4806693d2895928ac1b03585b2b2 (diff) | |
utils: lookup_unit_table: Use a stricter regex
In parse_count multiple units start with the same letter, so it would match different units depending on the order they were sorted when iterating over them.
| -rw-r--r-- | youtube_dl/utils.py | 2 | 
1 files changed, 1 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index ef6e7c7cb..bad1c4ea8 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1346,7 +1346,7 @@ def format_bytes(bytes):  def lookup_unit_table(unit_table, s):      units_re = '|'.join(re.escape(u) for u in unit_table)      m = re.match( -        r'(?P<num>[0-9]+(?:[,.][0-9]*)?)\s*(?P<unit>%s)' % units_re, s) +        r'(?P<num>[0-9]+(?:[,.][0-9]*)?)\s*(?P<unit>%s)$' % units_re, s)      if not m:          return None      num_str = m.group('num').replace(',', '.')  | 
