Prechádzať zdrojové kódy

Add more link types in BTR update script

Johannes Gütschow 3 mesiacov pred
rodič
commit
464268c775

+ 2 - 0
src/unfccc_ghg_data/unfccc_downloader/download_btr.py

@@ -27,8 +27,10 @@ from unfccc_ghg_data.unfccc_downloader import get_BTR_name_and_URL
 # how-to-download-a-file-using-seleniums-webdriver
 # for automatic downloading see https://stackoverflow.com/questions/70740163/
 # python-selenium-firefox-driver-dismiss-open-save-file-popup
+# TODO: use categories like in AnnexI downloading
 ###############
 
+
 if __name__ == "__main__":
     descr = (
         "Download and unzip data from UNFCCC Biannial Transparency Reports Submissions."

+ 7 - 0
src/unfccc_ghg_data/unfccc_downloader/fetch_submissions_btr.py

@@ -17,6 +17,8 @@ from unfccc_ghg_data.unfccc_downloader import (
     get_unfccc_submission_info,
 )
 
+# TODO: use categories like in AnnexI downloading (for round 2)
+
 if __name__ == "__main__":
     max_tries = 10
 
@@ -81,7 +83,12 @@ if __name__ == "__main__":
                 href = "https://unfccc.int" + href
             elif href.startswith("documents"):
                 href = "https://unfccc.int/" + href
+            if href.startswith("/node"):
+                href = "https://unfccc.int" + href
+            if href.startswith("/NODE"):
+                href = "https://unfccc.int" + href
             # Only add pages in the format https://unfccc.int/documents/65587
+            # or https://unfccc.int/[node/NODE]/65587
             # to further downloads
             if str(Path(href).parent).endswith("documents"):
                 targets.append({"title": title, "url": href})