diff --git a/packages/main/modules/com4399.test.ts b/packages/main/modules/com4399.test.ts index 2423792..11b5773 100644 --- a/packages/main/modules/com4399.test.ts +++ b/packages/main/modules/com4399.test.ts @@ -49,7 +49,20 @@ const testMap: Record = { "binUrl": "https://s4.4399.com/4399swf/upload_swf/ftp/20090929/1/pvz_9_15.swf", "icon": "http://imga3.5054399.com/upload_pic/2016/2/18/4399_18432063237.jpg" } - } + }, + "https://www.4399.com/flash/94107.htm": + { + "title": "愤怒的小鸟免费神鹰版", + "category": "益智", + "type": "flash", + "fromSite": "4399", + "online": { + "originPage": "http://www.4399.com/flash/94107.htm", + "truePage": "http://sxiao.4399.com/4399swf/upload_swf/ftp8/zhichang/20120723/001.swf", + "binUrl": "http://sxiao.4399.com/4399swf/upload_swf/ftp8/zhichang/20120723/001.swf", + "icon": "http://imga3.5054399.com/upload_pic/2012/7/23/4399_10113765770.jpg" + } + } } test("4399", async () => { //初始化模块 diff --git a/packages/main/modules/com4399.ts b/packages/main/modules/com4399.ts index 83ba642..0adce8c 100644 --- a/packages/main/modules/com4399.ts +++ b/packages/main/modules/com4399.ts @@ -4,7 +4,7 @@ import {GameInfo} from '../../class'; import {BrowserWindow} from 'electron'; import iconv from 'iconv-lite'; import cheerio from 'cheerio'; -import {GBKEncodeUri,GBKDecodeUri} from "./GBKUri"; +import {GBKDecodeUri, GBKEncodeUri} from "./GBKUri"; let cookie: string | null = null let updateCookie: (cookie: string) => void @@ -176,30 +176,13 @@ async function entrance(url: string): Promise> { resolve(pvzPatchRes) return } - // 加入直接拿 swf 路径的补丁 - const m=(originPage as string).match(/[/\w_]+\.swf/) - if(m?.length){ - const binUrl=fullUrl(m[0]) - if(!binUrl){ - return new Err(`Error:Failed to full url for '${m[0]}'`) - } - resolve(new Ok({ - title, - category, - type: "flash", - fromSite: "4399", - online: { - originPage: url, - truePage: binUrl, - binUrl, - icon: await getIcon(title, id) - } - })) + // 也有可能当前页就是真实页面 + if (originPage.match(/_strGamePath\s*=\s*".*"/)?.length) { + m = [`/flash/${id}.htm`] + } else { + resolve(new Err("Error:Can't parse playing page")) return } - - resolve(new Err("Error:Can't parse playing page")) - return } const playingPage = m[0] // console.log('playingPage:'+playingPage)