From d864d2ab5fcee8203d4bbc5def20d2b05043bb6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Wed, 19 Oct 2022 17:22:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=88=AC=E5=8F=96=E6=AD=8C=E5=8D=95=20?= =?UTF-8?q?=E7=AE=80=E5=8D=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qianqian_music/data/.gitkeep | 0 qianqian_music/index.js | 61 +++ .../category_convert_json_to_sql.js | 371 ++++++++++++++++++ .../category_update_group_chinese.sql | 5 + qianqian_music/temp/.gitkeep | 0 5 files changed, 437 insertions(+) create mode 100644 qianqian_music/data/.gitkeep create mode 100644 qianqian_music/index.js create mode 100644 qianqian_music/one_time_code/category_convert_json_to_sql.js create mode 100644 qianqian_music/one_time_code/category_update_group_chinese.sql create mode 100644 qianqian_music/temp/.gitkeep diff --git a/qianqian_music/data/.gitkeep b/qianqian_music/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/qianqian_music/index.js b/qianqian_music/index.js new file mode 100644 index 0000000..6e2ac12 --- /dev/null +++ b/qianqian_music/index.js @@ -0,0 +1,61 @@ +const fs = require('fs'); +const path = require('path'); + +const requestUtils = require('../utils/requestUtils'); + +const TEMP_MODULE_PATH = path.join(__dirname, 'temp'); +const DATA_PATH = path.join(__dirname, 'data'); + +/** + * 获取 html + */ +async function getHtml(url) { + // let html = fs.readFileSync("songlist"); + let html = await requestUtils.getApiResult(url, { + gzip: true, + }); + return html; +} + +/** + * 正则匹配出JSON + */ +function getData(html, index = 0) { + // 首先匹配出 window.__NUXT__ + let script = /