|
|
@ -447,12 +447,19 @@ async def handle_pad(args, padid, data, info, session): |
|
|
|
|
|
|
|
# Process text, html, dhtml, all options |
|
|
|
if args.all or args.html: |
|
|
|
url = info["localapiurl"] + "getHTML?" + urlencode(data) |
|
|
|
# mb: line causing the error of not writing the correct HTML content to the correct HTML file: |
|
|
|
# url = info["localapiurl"] + "getHTML?" + urlencode(data) |
|
|
|
# mb: warning, HACK! Catching the error by writing the API request url manually ... |
|
|
|
url = info["localapiurl"] + "getHTML?" + "padID=" + padid + "&" + 'apikey=' + data["apikey"] + '&startRev=0' |
|
|
|
# print(url) |
|
|
|
html = await agetjson(session, url) |
|
|
|
ver = {"type": "html"} |
|
|
|
versions.append(ver) |
|
|
|
# mb: warning, HACK! Added a Try and Except here, as it sometimes bumped into an error, stopping the pull. |
|
|
|
try: |
|
|
|
ver["code"] = html["_code"] |
|
|
|
if html["_code"] == 200: |
|
|
|
try: |
|
|
|
html = html["data"]["html"] |
|
|
|
ver["path"] = p + ".raw.html" |
|
|
|
ver["url"] = quote(ver["path"]) |
|
|
@ -465,6 +472,10 @@ async def handle_pad(args, padid, data, info, session): |
|
|
|
async with await trio.open_file(ver["path"], "w") as f: |
|
|
|
output = ET.tostring(doc, method="html", encoding="unicode") |
|
|
|
await f.write(output) |
|
|
|
except TypeError: |
|
|
|
ver["message"] = html["message"] |
|
|
|
except Exception as exception: |
|
|
|
print("PANIC: {}".format(exception)) |
|
|
|
|
|
|
|
# output meta |
|
|
|
if args.all or args.meta: |
|
|
|