fix: 修复爱奇艺地址无法访问&爱奇艺弹幕解析异常

This commit is contained in:
lyz05
2022-12-10 22:45:23 +08:00
parent 8d6fd3ef77
commit d64e5e995e
6 changed files with 2013 additions and 1933 deletions

View File

@@ -31,4 +31,10 @@ Express框架的性能也比Python的Django要好很多。
flyctl scale count 0
flyctl regions add sea
flyctl regions remove nrt
```
```
# Node常用工具
```bash
npm outdated
npm update
```

3910
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,13 +11,12 @@
},
"dependencies": {
"ali-oss": "^6.17.1",
"axios": "^1.1.3",
"axios": "^1.2.1",
"bootstrap": "^3.4.1",
"chai": "^4.3.7",
"chai-http": "^4.3.0",
"cookie": "^0.5.0",
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
"dotenv": "^16.0.3",
"ejs": "^3.1.8",
"express": "~4.18.2",
@@ -34,10 +33,8 @@
"node-telegram-bot-api": "^0.60.0",
"pako": "^1.0.11",
"querystring": "^0.2.1",
"tencentcloud-sdk-nodejs": "^4.0.480",
"whacko": "^0.19.1",
"xml-js": "^1.6.11",
"xml2js": "^0.4.23"
"xml-js": "^1.6.11"
},
"devDependencies": {
"eslint-config-airbnb-base": "^15.0.0",

View File

@@ -64,8 +64,8 @@ function Iqiyi() {
function extract(xml, tag) {
const reg = new RegExp(`<${tag}>(.*?)</${tag}>`, "g");
const res = xml.match(reg)
.map(x => x.substring(tag.length + 2, x.length - tag.length - 3));
return res;
?.map(x => x.substring(tag.length + 2, x.length - tag.length - 3));
return res || [];
}
this.xml2json = (xml, contents) => {
@@ -127,9 +127,10 @@ module.exports = Iqiyi;
if (!module.parent) {
const m = new Iqiyi();
m.work(m.example_urls[1]).then(() => {
// console.log(m.content);
console.log(m.title);
memory();
});
m.work(m.example_urls[1])
.then(() => {
// console.log(m.content);
console.log(m.title);
memory();
});
}

View File

@@ -21,7 +21,9 @@ async function build_response(url, req) {
}
console.log("Real url:", url);
try {
await axios.get(url);
await axios.get(url,{
headers: { "Accept-Encoding": "gzip,deflate,compress" }
});
} catch (e) {
console.log(e);
return { msg: "传入的链接非法!请检查链接是否能在浏览器正常打开" };

View File

@@ -89,7 +89,7 @@ describe("App", () => {
});
});
describe("机场订阅模块",function (){
this.timeout(1000*5);
this.timeout(1000*8);
it("接口不带参数测试", (done) =>{
chai.request(app)
.get("/sub")