mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
更新 getmodels 函数使用的链接
This commit is contained in:
parent
7fdd3952a4
commit
6c0818f719
@ -113,7 +113,7 @@ def getmodels(platforms=None):
|
|||||||
"""
|
"""
|
||||||
Get Syno Models.
|
Get Syno Models.
|
||||||
"""
|
"""
|
||||||
import json, requests, urllib3
|
import re, json, 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
|
||||||
|
|
||||||
@ -127,20 +127,23 @@ def getmodels(platforms=None):
|
|||||||
|
|
||||||
models = []
|
models = []
|
||||||
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"
|
||||||
req.encoding = "utf-8"
|
#url = "https://update7.synology.com/autoupdate/genRSS.php?include_beta=1"
|
||||||
data = json.loads(req.text)
|
|
||||||
|
|
||||||
for item in data["channel"]["item"]:
|
req = session.get(url, timeout=10, verify=False)
|
||||||
if not item["title"].startswith("DSM"):
|
req.encoding = "utf-8"
|
||||||
|
p = re.compile(r"<mUnique>(.*?)</mUnique>.*?<mLink>(.*?)</mLink>", re.MULTILINE | re.DOTALL)
|
||||||
|
|
||||||
|
data = p.findall(req.text)
|
||||||
|
for item in data:
|
||||||
|
if not "DSM" in item[1]:
|
||||||
continue
|
continue
|
||||||
for model in item["model"]:
|
arch = item[0].split("_")[1]
|
||||||
arch = model["mUnique"].split("_")[1]
|
name = item[1].split("/")[-1].split("_")[1].replace("%2B", "+")
|
||||||
name = model["mLink"].split("/")[-1].split("_")[1].replace("%2B", "+")
|
if PS and arch.lower() not in PS:
|
||||||
if PS and arch.lower() not in PS:
|
continue
|
||||||
continue
|
if not any(m["name"] == name for m in models):
|
||||||
if not any(m["name"] == name for m in models):
|
models.append({"name": name, "arch": arch})
|
||||||
models.append({"name": name, "arch": arch})
|
|
||||||
|
|
||||||
models.sort(key=lambda k: (k["arch"], k["name"]))
|
models.sort(key=lambda k: (k["arch"], k["name"]))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user