Fixed sso & 2fa cookie gen bug Fixed #3 & #8. Added file type filtering Fixed #2

This commit is contained in:
Eddy Hintze
2020-01-19 22:31:43 -05:00
parent b0a06d8bc0
commit 7168258191
4 changed files with 33 additions and 3 deletions

View File

@@ -17,7 +17,13 @@ def _clean_name(dirty_str):
return "".join(clean).strip()
def download_library(cookie_path, library_path, progress_bar=False):
def download_library(cookie_path, library_path, progress_bar=False,
ext_include=None, ext_exclude=None):
if ext_include is None:
ext_include = []
if ext_exclude is None:
ext_exclude = []
# Load cookies
with open(cookie_path, 'r') as f:
account_cookies = f.read()
@@ -66,8 +72,15 @@ def download_library(cookie_path, library_path, progress_bar=False):
except KeyError:
logger.info("No url found for " + item_title)
continue
ext = url.split('?')[0].split('.')[-1]
file_title = item_title + "." + ext
# Only get the file types we care about
if ((ext_include and ext not in ext_include)
or (ext_exclude and ext in ext_exclude)):
logger.info("Skipping the file " + file_title)
continue
filename = os.path.join(item_folder, file_title)
item_r = requests.get(url, stream=True)
logger.debug("Item request: {item_r}, Url: {url}"