From 46d724b4656fc09fd96f9452e39d6db178c1d298 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Thu, 1 Jul 2021 19:47:47 +0800 Subject: [PATCH] update sparkle --- nvchecker_source/sparkle.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/nvchecker_source/sparkle.py b/nvchecker_source/sparkle.py index eff188f..33bd61f 100644 --- a/nvchecker_source/sparkle.py +++ b/nvchecker_source/sparkle.py @@ -13,19 +13,6 @@ async def get_version(name, conf, *, cache, **kwargs): async def get_version_impl(sparkle): res = await session.get(sparkle) root = ElementTree.fromstring(res.body) - item = root.find('./channel/item[1]/enclosure') + version = root.find('./channel/item[1]/{http://www.andymatuschak.org/xml-namespaces/sparkle}version') - version_string = item.get('{http://www.andymatuschak.org/xml-namespaces/sparkle}shortVersionString') - build_number = item.get('{http://www.andymatuschak.org/xml-namespaces/sparkle}version') - - if (version_string and version_string.isdigit()) and (build_number and not build_number.isdigit()): - version_string, build_number = build_number, version_string - - version = [] - - if version_string: - version.append(version_string) - if build_number and (build_number not in version): - version.append(build_number) - - return '-'.join(version) if version else None + return version.text