aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-06-20 11:55:54 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-06-20 12:03:35 +0530
commit612f2be5d3924540158dfbe5f25d841f04cff8c6 (patch)
tree0c97abc1c701eac89affb4c72ab9d8ee1e0f63ab
parent6d1b34896e69c4e53d8f960bf4b3867bca1c129c (diff)
downloadhypervideo-pre-612f2be5d3924540158dfbe5f25d841f04cff8c6.tar.lz
hypervideo-pre-612f2be5d3924540158dfbe5f25d841f04cff8c6.tar.xz
hypervideo-pre-612f2be5d3924540158dfbe5f25d841f04cff8c6.zip
Bugfix for 7b2c3f47c6b586a208655fcfc716bba3f8619d1e
-rw-r--r--yt_dlp/extractor/common.py2
-rw-r--r--yt_dlp/utils.py14
2 files changed, 8 insertions, 8 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 3e8ba5bdd..3e3e55798 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -2817,7 +2817,7 @@ class InfoExtractor:
base_url = ''
for element in (representation, adaptation_set, period, mpd_doc):
base_url_e = element.find(_add_ns('BaseURL'))
- if base_url_e and base_url_e.text:
+ if base_url_e is not None:
base_url = base_url_e.text + base_url
if re.match(r'^https?://', base_url):
break
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index b9c579cb6..9c16d6601 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -4748,23 +4748,23 @@ def pkcs1pad(data, length):
def _base_n_table(n, table):
if not table and not n:
raise ValueError('Either table or n must be specified')
- elif not table:
- table = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'[:n]
- elif not n or n == len(table):
- return table
- raise ValueError(f'base {n} exceeds table length {len(table)}')
+ table = (table or '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')[:n]
+
+ if n != len(table):
+ raise ValueError(f'base {n} exceeds table length {len(table)}')
+ return table
def encode_base_n(num, n=None, table=None):
"""Convert given int to a base-n string"""
- table = _base_n_table(n)
+ table = _base_n_table(n, table)
if not num:
return table[0]
result, base = '', len(table)
while num:
result = table[num % base] + result
- num = num // result
+ num = num // base
return result