Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: aDrive, Notepad--, Youku #126

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions tasks/Notepad--/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
name = "Notepad--"
category = "办公编辑"
author = "undefined"
url = "https://github.com/cxasm/notepad--"
url = "https://gitee.com/cxasm/notepad--/releases/latest"

# 指定使用的模板
[template]
# scraper = ""
scraper = "Global_Page_Match"
# resolver = ""
producer = "Recursive_Unzip"

# 使用到的正则
[regex]
# download_link = ''
download_link = '\/cxasm\/notepad--\/releases\/download\/v\d+(\.\d+)+\/Notepad--v\d+(\.\d+)+-win10-portable*\.zip'
download_name = 'Notepad--v\d+(\.\d+)+-win10-portable*\.zip'
# scraper_version = ''

# 通用参数
[parameter]
# resolver_cd = []
Expand All @@ -27,17 +26,19 @@ build_manifest = ["${taskName}.wcs","${taskName}"]
# build_delete = []

# 爬虫模板临时参数
# [scraper_temp]
[scraper_temp]
ua = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0"
version_selector = ".icon-tag~ *"

# 自动制作模板要求的参数
[producer_required]
shortcutName = "Notepad--"
sourceFile = "Notepad--.exe"
recursiveUnzipList = ["/Notepad--v\d+(\.\d+)+-win10-portable/" ]
recursiveUnzipList = ["/Notepad--v\\d+(\\.\\d+)+-win10-portable/" ]


# 额外备注
[extra]
# require_windows = true
# missing_version = ""
weekly = true
# weekly = true
2 changes: 1 addition & 1 deletion tasks/优酷/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ recursiveUnzipList = []
[extra]
# require_windows = false
# missing_version = ""
weekly = true
# weekly = true
27 changes: 8 additions & 19 deletions tasks/优酷/scraper.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
import { Ok, Err, Result } from "ts-results";
import { Ok, Result } from "ts-results";
import { ScraperReturned } from "../../src/class";
import { robustGet } from "../../src/network";

export default async function (): Promise<Result<ScraperReturned, string>> {
const page = (
await robustGet("https://youku.com/product/index")
).unwrap() as string;

// 匹配初始化数据
const jsonTextMatch = page.match(/window\.__INITIAL_DATA__\s*=\s*([^;]+);/g);
if (jsonTextMatch == null) return new Err("Error:Can't match initial data");
const json = JSON.parse(
jsonTextMatch[0].split(/window.__INITIAL_DATA__\s*=\s*/)[1].slice(0, -1),
);
// console.log(JSON.stringify(json,null,2))

// 选中pc版
const node = json[0].subNav[0];
// console.log(JSON.stringify(node,null,2))

const prefix = "https://pcclient.download.youku.com/iku-win-release/";
const versionUrl = `${prefix}latest.yml?noCache=${Math.random()}`;
const versionInfo: any = (await robustGet(versionUrl)).unwrap() as string;
const version = versionInfo.match(/version: (.+)/)[1];
const downloadLink = prefix + versionInfo.match(/url: (.+)/)[1];
return new Ok({
version: node.ver,
downloadLink: node.downloadUrl,
version,
downloadLink,
});
}
2 changes: 1 addition & 1 deletion tasks/阿里云盘/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ recursiveUnzipList = []
# 额外备注
[extra]
# require_windows = false
missing_version = "${taskName}/aDrive.exe"
# missing_version = "${taskName}/aDrive.exe"
17 changes: 14 additions & 3 deletions tasks/阿里云盘/scraper.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import { Ok, Result } from "ts-results";
import { ScraperReturned } from "../../src/class";
import { robustGet } from "../../src/network";

export default async function (): Promise<Result<ScraperReturned, string>> {
const versionApi: any = (
await robustGet("https://www.aliyundrive.com/desktop/version/update.json", {
responseType: "json",
})
).unwrap();
const versionUrl = `${
versionApi.url
}/win32/x64/latest.yml?noCache=${Math.random()}`;
const versionInfo: any = (await robustGet(versionUrl)).unwrap() as string;
const version = versionInfo.match(/version: (.+)/)[1];
const downloadLink = versionInfo.match(/url: (.+)/)[1];
return new Ok({
version: "0.0.0",
downloadLink:
"https://cdn.aliyundrive.net/downloads/apps/desktop/aDrive.exe",
version,
downloadLink,
});
}