Feat: save html description in case we need it

This commit is contained in:
Ovear 2022-09-29 16:10:59 +08:00
parent cda7f5bfb4
commit 263a429bcb
2 changed files with 12 additions and 1 deletions

View file

@ -127,6 +127,13 @@ parser.add_argument(
action="store_true",
help="download description as a JSON list",
)
parser.add_argument(
"--html-description",
"-hd",
dest="html_description",
action="store_true",
help="save description in original html format",
)
parser.add_argument(
"--login",
action="store_true",
@ -167,6 +174,7 @@ login = args.login
check = args.check
index = args.index
submissions = args.submissions
html_description = args.html_description
json_description = args.json_description
metadata = args.metadata
dont_redownload = args.redownload

View file

@ -76,7 +76,10 @@ def download(path):
idx.write(f"({view_id})\n")
if config.metadata is True:
dsc = s.find(class_="submission-description").text.strip().replace("\r\n", "\n")
if config.html_description is True:
dsc = s.find(class_="submission-description").prettify()
else:
dsc = s.find(class_="submission-description").text.strip().replace("\r\n", "\n")
if config.json_description is True:
dsc = []
data = {