From 02eb6d6821ddacce86fd2eeb9423623a26d75c14 Mon Sep 17 00:00:00 2001 From: lyz05 <294068487@qq.com> Date: Tue, 8 Nov 2022 16:22:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=99=90=E5=88=B6=E6=97=A7=E5=86=85?= =?UTF-8?q?=E5=AD=98=E9=83=A8=E5=88=86=E7=9A=84=E6=9C=80=E5=A4=A7=E5=86=85?= =?UTF-8?q?=E5=AD=98=E5=A4=A7=E5=B0=8F=E4=B8=BA128M=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- routes/api/iqiyi.js | 5 ++--- routes/api/mgtv.js | 4 ++-- routes/api/tencentvideo.js | 4 ++-- routes/api/youku.js | 3 +-- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 19b72f2..7b5f1b2 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "0.1.0", "private": true, "scripts": { - "start": "node ./bin/www", - "dev": "nodemon ./bin/www", + "start": "node --max-old-space-size=128 ./bin/www", + "dev": "nodemon --max-old-space-size=128 ./bin/www", "test": "nyc -a mocha --recursive" }, "dependencies": { diff --git a/routes/api/iqiyi.js b/routes/api/iqiyi.js index 7817623..c2c0833 100644 --- a/routes/api/iqiyi.js +++ b/routes/api/iqiyi.js @@ -1,10 +1,9 @@ const axios = require('axios'); -const convert = require('xml-js'); const pako = require('pako'); const cheerio = require('cheerio'); const {time_to_second, make_response, content_template} = require('./utils'); - +//资源消耗大 256M内存扛不住 function Iqiyi() { this.name = '爱奇艺' this.domain = 'iqiyi.com' @@ -57,7 +56,7 @@ function Iqiyi() { for (const data of datas) { const xml = pako.inflate(data, {to: 'string'}) const $ = cheerio.load(xml, {xmlMode: true}); - $('bulletInfo').each(function (i, elem) { + $('bulletInfo').each(function () { var content = JSON.parse(JSON.stringify(content_template)); content.timepoint = $(this).find('showTime').text()//showTime content.color = parseInt($(this).find('color').text(), 16)//color diff --git a/routes/api/mgtv.js b/routes/api/mgtv.js index 0613f29..b7c8162 100644 --- a/routes/api/mgtv.js +++ b/routes/api/mgtv.js @@ -1,13 +1,13 @@ const urlmodule = require('url'); const axios = require('axios'); -const convert = require('xml-js'); const {time_to_second, make_response, content_template} = require('./utils'); function Mgtv() { this.name = '芒果TV' this.domain = 'mgtv.com' this.example_urls = [ - 'https://www.mgtv.com/b/336727/8087768.html' + 'https://www.mgtv.com/b/336727/8087768.html', + 'https://www.mgtv.com/b/459529/17730031.html' //api lens 90 ]; this.resolve = async (url) => { diff --git a/routes/api/tencentvideo.js b/routes/api/tencentvideo.js index 7088a8e..f6bcf59 100644 --- a/routes/api/tencentvideo.js +++ b/routes/api/tencentvideo.js @@ -1,6 +1,5 @@ const urlmodule = require('url'); const axios = require('axios'); -const convert = require('xml-js'); const cheerio = require("cheerio"); const {make_response, content_template} = require('./utils'); @@ -9,7 +8,8 @@ function Tencentvideo() { this.name = '腾讯视频' this.domain = 'v.qq.com' this.example_urls = [ - 'https://v.qq.com/x/cover/mzc002003pn34qk/u3319i5s3jt.html' + 'https://v.qq.com/x/cover/mzc002003pn34qk/u3319i5s3jt.html', + 'https://v.qq.com/x/cover/53q0eh78q97e4d1/x00174aq5no.html'//api lens 50 ]; this.resolve = async (url) => { diff --git a/routes/api/youku.js b/routes/api/youku.js index 08d78c3..97e7d78 100644 --- a/routes/api/youku.js +++ b/routes/api/youku.js @@ -1,10 +1,10 @@ const urlmodule = require('url'); const axios = require('axios'); -const convert = require('xml-js'); const cookie = require('cookie'); const crypto = require('crypto'); const {make_response, content_template} = require('./utils'); +//资源消耗大 256M内存扛不住 function Youku() { this.name = '优酷' this.domain = 'v.youku.com' @@ -48,7 +48,6 @@ function Youku() { const q = urlmodule.parse(url, true); const path = q.pathname.split('/'); const video_id = path.slice(-1)[0].split('.')[0].slice(3); - const duration = 0 if (video_id) { // "?client_id=53e6cc67237fc59a&package=com.huawei.hwvplayer.youku&ext=show&video_id={}" api_url = "https://openapi.youku.com/v2/videos/show.json"