save
15
node/rename.js
Normal file
@ -0,0 +1,15 @@
|
||||
import fs from 'fs'
|
||||
|
||||
let read = './xhs/imgs/'
|
||||
let save = "./xhs/imgs2/";
|
||||
|
||||
const dirs = fs.readdirSync(read)
|
||||
dirs.forEach(dictName => {
|
||||
formatDict(read, dictName)
|
||||
})
|
||||
|
||||
function formatDict(dir, name) {
|
||||
let filePath = dir + name
|
||||
fs.copyFile(filePath, save + name.replace('.webp', '.png'), () => {
|
||||
})
|
||||
}
|
||||
90
node/xhs/process-xhs-img.js
Normal file
@ -0,0 +1,90 @@
|
||||
import fs from 'fs'
|
||||
import request from 'request'
|
||||
import {nanoid} from 'nanoid'
|
||||
|
||||
let fileName = './xhs.json'
|
||||
let savefileName = './xhs-save.json'
|
||||
let saveFileStr = fs.readFileSync(fileName, "utf8");
|
||||
let inputData = JSON.parse(saveFileStr);
|
||||
|
||||
|
||||
const downloadImage = async (src, dest, callback) => {
|
||||
console.log('下载:', src, dest, Date.now())
|
||||
return new Promise(resolve => {
|
||||
request.head(src, (err, res, body) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return;
|
||||
}
|
||||
src &&
|
||||
request(src)
|
||||
.pipe(fs.createWriteStream(dest))
|
||||
.on("close", () => {
|
||||
setTimeout(resolve, 1500)
|
||||
callback && callback(null, dest);
|
||||
});
|
||||
});
|
||||
})
|
||||
};
|
||||
|
||||
let saveFilePath = './imgs/'
|
||||
|
||||
let imgList = []
|
||||
|
||||
async function test(list) {
|
||||
for (let j = 0; j < list.length; j++) {
|
||||
let a = list[j]
|
||||
let coverUrl = a.info_list[0].url
|
||||
|
||||
let rIndex = imgList.findIndex(v => v.url === coverUrl)
|
||||
if (rIndex === -1) {
|
||||
if (coverUrl.includes('http')) {
|
||||
let name = nanoid() + '.png'
|
||||
imgList.push({
|
||||
name,
|
||||
url: coverUrl
|
||||
})
|
||||
await downloadImage(coverUrl, saveFilePath + name, () => {
|
||||
// console.log('close', name)
|
||||
list[j] = {
|
||||
info_list: [{
|
||||
url: name
|
||||
}]
|
||||
}
|
||||
fs.writeFileSync(savefileName, JSON.stringify(inputData, null, 2));
|
||||
})
|
||||
}
|
||||
} else {
|
||||
list[j] = {
|
||||
info_list: [{
|
||||
url: imgList[rIndex].name
|
||||
}]
|
||||
}
|
||||
console.log('重复')
|
||||
fs.writeFileSync(savefileName, JSON.stringify(inputData, null, 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < inputData.slice(0, 111111).length; i++) {
|
||||
let v = inputData[i]
|
||||
|
||||
if (v.note_card?.cover) {
|
||||
let url = v.note_card?.cover?.url_default
|
||||
let name = nanoid() + '.png'
|
||||
imgList.push({
|
||||
name,
|
||||
url: url
|
||||
})
|
||||
await downloadImage(url, saveFilePath + name, () => {
|
||||
// console.log('close', name)
|
||||
v.note_card.cover = {url_default: name}
|
||||
fs.writeFileSync(savefileName, JSON.stringify(inputData, null, 2));
|
||||
})
|
||||
}
|
||||
|
||||
if (v.note_card?.image_list) {
|
||||
await test(v.note_card.image_list)
|
||||
}
|
||||
}
|
||||
|
||||
3105
node/xhs/xhs-save.json
Normal file
4976
node/xhs/xhs.json
Normal file
@ -16,7 +16,6 @@
|
||||
"lodash-es": "^4.17.21",
|
||||
"mitt": "3.0.0",
|
||||
"mobile-select": "1.1.2",
|
||||
"mockjs": "1.1.0",
|
||||
"pinia": "^2.1.7",
|
||||
"pinyin": "2.11.1",
|
||||
"vue": "3.4.21",
|
||||
|
||||
@ -29,9 +29,6 @@ dependencies:
|
||||
mobile-select:
|
||||
specifier: 1.1.2
|
||||
version: 1.1.2
|
||||
mockjs:
|
||||
specifier: 1.1.0
|
||||
version: 1.1.0
|
||||
pinia:
|
||||
specifier: ^2.1.7
|
||||
version: 2.1.7(vue@3.4.21)
|
||||
@ -1431,11 +1428,6 @@ packages:
|
||||
keypress: 0.1.0
|
||||
dev: false
|
||||
|
||||
/commander@11.1.0:
|
||||
resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==}
|
||||
engines: {node: '>=16'}
|
||||
dev: false
|
||||
|
||||
/concat-map@0.0.1:
|
||||
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
||||
requiresBuild: true
|
||||
@ -2032,13 +2024,6 @@ packages:
|
||||
resolution: {integrity: sha512-FrVAun32DsxLUZziTE1LPlXC72kD13f8N8tqgf7zVWRIOIIJakNxVs8mR2KMzm3QJAYq5+EJ4ji98pHdWJ7ekw==}
|
||||
dev: false
|
||||
|
||||
/mockjs@1.1.0:
|
||||
resolution: {integrity: sha512-eQsKcWzIaZzEZ07NuEyO4Nw65g0hdWAyurVol1IPl1gahRwY+svqzfgfey8U8dahLwG44d6/RwEzuK52rSa/JQ==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
commander: 11.1.0
|
||||
dev: false
|
||||
|
||||
/mrmime@2.0.0:
|
||||
resolution: {integrity: sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
131800
public/data/posts.json
130585
public/data/videos.json
Normal file
BIN
public/images/-2NSnBjGS59MQfxFOze7f.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
public/images/-Ur44wwXkkmG7sZfuAJMh.png
Normal file
|
After Width: | Height: | Size: 93 KiB |
BIN
public/images/-YXQwyUPxvCgRmjDfCD2-.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
public/images/0-LTe4d2KhnBGMTwh9A1c.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
public/images/0-jc-pN1B1jk-xpwQEhsv.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
public/images/0B4fm1P6R3X72r6KFRerI.png
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
public/images/0hqGW11Powq-QDzZUW6Dd.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
public/images/0l86eI2xmuBdJ4mS8C0l8.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
public/images/0zDOOkSk5706LscrNC0Sr.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
public/images/1C6WrVxkVPWlC85Yzp9tU.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
public/images/1wMAMeRXIhNhRI6o6muYU.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
public/images/2HGy0keKop9QefkVtF0VO.png
Normal file
|
After Width: | Height: | Size: 123 KiB |
BIN
public/images/2S9bbgb-Sf2kIdSTxoeTw.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
public/images/2ZArbx-y21EvBMBCxm6zv.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
public/images/2b2rpive_RVzDrYgo-F9K.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/images/2o32jjnNEl4pgoQAk-E3g.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/images/2yUVAmMwRuKtfk4Vh57mj.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
public/images/3FdY2I9un4BFQrXfNDSpN.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
public/images/3bOgxlAuIMonDKQ38Caqz.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
public/images/4E_lQjeqr7ZiHl17zeVnP.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
public/images/4Jc6bM-gX9crRFw7nIAuy.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/images/4T71kAxF3spUBjPM-BKyu.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
public/images/4URcOtugZ9w9hwY-qRF37.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/images/4XSjhpWvVMVw2BRfIW4Tx.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/images/4a4TtExpq7RXnKK3hylKU.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
public/images/50thegdRDwgYiI76KsALI.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
public/images/5YHxt1WM1Q8FM-n7JpjDZ.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
public/images/6-IUsyJr29EqyxjgNu-RT.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
public/images/64l4Ut8qGrRAxtgZC1jot.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
public/images/6GHTNzmChI82xa5aD_4Lf.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
public/images/6zAelubQNtYXl4QeMS0eO.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
public/images/74fCgIP1bpuxV7Olf8x3B.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
public/images/7tTest2fAPOPAtVPTP_JN.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
public/images/8_JpVIIjaYIn3_xCH23s3.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
public/images/9Q4dhoggwEUYVJQteCiI2.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
public/images/9fr4YhnWsbDVkprAYXCAn.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
public/images/A-ZZ20sdh4lBcFtaT0fOY.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
public/images/Aleen5rDMK7bxU9hl_9Yk.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
public/images/AukNIqc_JHrw043L_V8Ld.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
public/images/Az5GCldv_LPzz4tK0bpks.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
public/images/BxMcpEEJIBoB1FemFaQAh.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
public/images/Byg8arBz0LqntZS_H4ssB.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
public/images/CqayPxAcvCtdGhcr_gi5B.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
public/images/DqdkFZoKaoP2LjQ46-LJD.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
public/images/DsaYUAh8QjynOHh20hojQ.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
public/images/EH55GbdKR8mLim5Iv7onx.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
public/images/EOanR8G8qXAMvzx2Gz_BJ.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
public/images/EYy25cV19FPslAsvyHYKb.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
public/images/EuL5yD-9W3NSMDdK4x2nQ.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
public/images/EvTM8VTKw_it1tE7bYSEC.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
public/images/F3JedDqakrU_CbCPCi6B2.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
public/images/F_jtWhBDEnRFfz_kGlybD.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
public/images/Fod3cydJx_1QzAWRhsdPw.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
public/images/G5p1JP-JanJNplS41EFbG.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
public/images/GC-l5ohG2axks3NFBQgbv.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
public/images/GKUBh2GLi4uZy6aBny5Xl.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
public/images/GQL9kprFM_1sgWYGGcydo.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
public/images/GnqvNSXRmYrPynMLYk8Zg.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
public/images/GuytaFhTv6coM4VIT3O90.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
public/images/H1OQKBMleJ9_h6guCj-Iy.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
public/images/HHp4wNFvDYjTrsJ7UhWko.png
Normal file
|
After Width: | Height: | Size: 101 KiB |
BIN
public/images/HRB-W4xv3n5DypcyEeh9T.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
public/images/Hohldf_RVtiCtTo2_33Av.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
public/images/IAw71IEez0K_UEJ_wf9Ue.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
public/images/IhL2TH3P2_db46ae9I69_.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
BIN
public/images/Iqv4oSiMBbZzurd0mq2Im.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
public/images/IvG1MsdiibPfw2k6Kaz-R.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
public/images/JoWLzGk68mZF3qnr0Am-F.png
Normal file
|
After Width: | Height: | Size: 102 KiB |
BIN
public/images/JqkapfbpdRIlbGPajICgF.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
public/images/K0FDbg4nGu4-gzu4iAORt.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
public/images/KG7hFSCzi7tnJ6EIN-pjd.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
public/images/KKw_e74TpQy1604_iRuc7.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
public/images/KLICtEbgUoxCVOxne5BEt.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
public/images/KYgHhWr1u4JTtPg1U1CtX.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/images/KnzPVUQyy_1dlcKk4bFfw.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
public/images/L-aPrCE0jU-oZCnBNaCF6.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
public/images/L4fbcjo5FQDkVN_8oR5GZ.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
public/images/LJ-8p2jF3HydBD5j28PgQ.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
public/images/LTHMygdVJSkyJJaHCbgm7.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
public/images/LTOPy_lQZTdgC07VKxbaH.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
public/images/Ld4krzXYGlX1lkhSo5Hiw.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
public/images/Lop_epBRvqSimCZ7iXZt-.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
public/images/LwjS8nlyMIPf3kTW5Nih1.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
public/images/MLKkKSVi-8u6UFKicd0ob.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
public/images/M_KrhtkiYDpTJ-pqoXgoD.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
public/images/M_v-SiaZaz5eqrXgXkEX_.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
public/images/MiuwnjvW7WcolQ49C_JIb.png
Normal file
|
After Width: | Height: | Size: 111 KiB |
BIN
public/images/MsZw-SVOyV5frwz7BtEqD.png
Normal file
|
After Width: | Height: | Size: 131 KiB |
BIN
public/images/N4FyQkza5n2JFhGo7Lsuy.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
public/images/NLIYDa5eCIbpr2rFJVfYt.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
public/images/NNKnXR1mNK0AsNgn9OQuR.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
public/images/NWUzdPKAps4wdRjsgp7GC.png
Normal file
|
After Width: | Height: | Size: 41 KiB |