mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
更新 getmodels 函数使用的链接
This commit is contained in:
parent
9b69ec7211
commit
f53d019c04
@ -6,7 +6,7 @@
|
|||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
#
|
#
|
||||||
|
|
||||||
import os, sys, glob, json, yaml, click, shutil, tarfile, kmodule, requests, urllib3
|
import os, re, sys, glob, json, yaml, click, shutil, tarfile, kmodule, requests, urllib3
|
||||||
from requests.adapters import HTTPAdapter
|
from requests.adapters import HTTPAdapter
|
||||||
from requests.packages.urllib3.util.retry import Retry # type: ignore
|
from requests.packages.urllib3.util.retry import Retry # type: ignore
|
||||||
from openpyxl import Workbook
|
from openpyxl import Workbook
|
||||||
@ -44,19 +44,23 @@ def getmodels(workpath, jsonpath, xlsxpath):
|
|||||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
req = session.get("https://autoupdate.synology.com/os/v2", timeout=10, verify=False)
|
url = "http://update7.synology.com/autoupdate/genRSS.php?include_beta=1"
|
||||||
|
#url = "https://update7.synology.com/autoupdate/genRSS.php?include_beta=1"
|
||||||
|
|
||||||
|
req = session.get(url, timeout=10, verify=False)
|
||||||
req.encoding = "utf-8"
|
req.encoding = "utf-8"
|
||||||
data = json.loads(req.text)
|
p = re.compile(r"<mUnique>(.*?)</mUnique>.*?<mLink>(.*?)</mLink>", re.MULTILINE | re.DOTALL)
|
||||||
|
|
||||||
|
data = p.findall(req.text)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
click.echo(f"Error: {e}")
|
click.echo(f"Error: {e}")
|
||||||
return
|
return
|
||||||
|
|
||||||
for item in data["channel"]["item"]:
|
for item in data:
|
||||||
if not item["title"].startswith("DSM"):
|
if not "DSM" in item[1]:
|
||||||
continue
|
continue
|
||||||
for model in item["model"]:
|
arch = item[0].split("_")[1]
|
||||||
arch = model["mUnique"].split("_")[1].lower()
|
name = item[1].split("/")[-1].split("_")[1].replace("%2B", "+")
|
||||||
name = model["mLink"].split("/")[-1].split("_")[1].replace("%2B", "+")
|
|
||||||
if arch not in models:
|
if arch not in models:
|
||||||
continue
|
continue
|
||||||
if name in (A for B in models for A in models[B]["models"]):
|
if name in (A for B in models for A in models[B]["models"]):
|
||||||
@ -99,20 +103,23 @@ def getpats(workpath, jsonpath, xlsxpath):
|
|||||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
req = session.get("https://autoupdate.synology.com/os/v2", timeout=10, verify=False)
|
url = "http://update7.synology.com/autoupdate/genRSS.php?include_beta=1"
|
||||||
|
#url = "https://update7.synology.com/autoupdate/genRSS.php?include_beta=1"
|
||||||
|
|
||||||
|
req = session.get(url, timeout=10, verify=False)
|
||||||
req.encoding = "utf-8"
|
req.encoding = "utf-8"
|
||||||
data = json.loads(req.text)
|
p = re.compile(r"<mUnique>(.*?)</mUnique>.*?<mLink>(.*?)</mLink>", re.MULTILINE | re.DOTALL)
|
||||||
|
data = p.findall(req.text)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
click.echo(f"Error: {e}")
|
click.echo(f"Error: {e}")
|
||||||
return
|
return
|
||||||
|
|
||||||
models = []
|
models = []
|
||||||
for item in data["channel"]["item"]:
|
for item in data:
|
||||||
if not item["title"].startswith("DSM"):
|
if not "DSM" in item[1]:
|
||||||
continue
|
continue
|
||||||
for model in item["model"]:
|
arch = item[0].split("_")[1]
|
||||||
arch = model["mUnique"].split("_")[1].lower()
|
name = item[1].split("/")[-1].split("_")[1].replace("%2B", "+")
|
||||||
name = model["mLink"].split("/")[-1].split("_")[1].replace("%2B", "+")
|
|
||||||
if arch not in platforms:
|
if arch not in platforms:
|
||||||
continue
|
continue
|
||||||
if name in models:
|
if name in models:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user