From bab21fe38744993b73684b0815142010a28bfeef Mon Sep 17 00:00:00 2001 From: Andrew Sampson Date: Fri, 23 Aug 2024 10:59:29 +0800 Subject: [PATCH] Fix PyPi check since PyPi changed their HTML structure --- third_party_license_file_generator/licenses/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/third_party_license_file_generator/licenses/__init__.py b/third_party_license_file_generator/licenses/__init__.py index 140efe2..c7d0e1b 100644 --- a/third_party_license_file_generator/licenses/__init__.py +++ b/third_party_license_file_generator/licenses/__init__.py @@ -115,7 +115,8 @@ def get_license_from_pypi_license_scrape(module_name): if r.status_code != 200: return None - return r.text.split("

License:")[-1].split("

")[0].strip().split("\n")[0] + match = re.search("License:([^<]+)", r.text) + return match.group(1).strip() if match is not None else None def get_license_from_github_home_page_scrape(url):