From bea588288cc891e118a8e097463e2e337ba47d4c Mon Sep 17 00:00:00 2001 From: skurzinz Date: Tue, 22 Jun 2021 12:13:53 +0000 Subject: [PATCH] use real txt filename in the zipped file contents --- txtDownloader.ipynb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/txtDownloader.ipynb b/txtDownloader.ipynb index 7039e21..1627003 100644 --- a/txtDownloader.ipynb +++ b/txtDownloader.ipynb @@ -107,9 +107,8 @@ "\n", "for page in data[\"sequences\"][0][\"canvases\"]:\n", " txt_url = page[\"otherContent\"][0][\"resources\"][0][\"resource\"][\"@id\"]\n", - " i=i+1\n", " print(\"downloading \" + txt_url)\n", - " output_file = str(i) + \".txt\"\n", + " output_file = str(txt_url.split('/')[-1])\n", " with urllib.request.urlopen(txt_url) as response, open(output_file, \"wb\") as out_file:\n", " shutil.copyfileobj(response, out_file)\n", " zipObj.write(os.path.abspath(output_file),output_file)\n", @@ -153,4 +152,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} -- GitLab