Skip to content

Commit

Permalink
download: log format missing instead of failing silently
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Sep 5, 2023
1 parent 047a533 commit 6021f80
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions download.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,13 @@ async def downloadFile(sess, urls, formats, packtypes, download_loc_filename):
fl.append(formats)
formats = fl

print(f"{totalUrl}; src: {urls} | dst: {download_loc_filename}")
print(f"read: {totalUrl}; src: {urls} | dst: {download_loc_filename}")

for i in range(0, len(urls)):
url = urls[i]
if len(formats) <= i:
print(f"format missing for {url}")
continue
format = formats[i]
domains = ""
response = ""
Expand Down Expand Up @@ -253,12 +256,18 @@ async def downloadFile(sess, urls, formats, packtypes, download_loc_filename):
r'^(\|\||[a-zA-Z0-9])([a-zA-Z0-9][a-zA-Z0-9-_.]+)((\^[a-zA-Z0-9\-\|\$\.\*]*)|(\$[a-zA-Z0-9\-\|\.])*|(\\[a-zA-Z0-9\-\||\^\.]*))$',
1)

if (len(domains) > 0):
if (len(alldomains) > 0):
dlen = len(domains)
alen = len(alldomains)
if (dlen > 0):
print(f"\t total domains in {url} of type {format}: {dlen}\n")
if (alen > 0):
alldomains = alldomains + "\n" + domains
else:
alldomains = domains

alen = len(alldomains)
print(f"write: {totalUrl}; src: {urls} | dst: {download_loc_filename} | tot: {alen} of ({len(urls)}) urls\n")

ret = writeFile(download_loc_filename, alldomains)

if not ret:
Expand Down

0 comments on commit 6021f80

Please sign in to comment.