1
0
Fork 0
This commit is contained in:
程序员小墨 2023-06-27 15:07:09 +08:00
parent 1293b1af33
commit 740e8332cb
10 changed files with 67427 additions and 334 deletions

View File

@ -0,0 +1,80 @@
let a = `1990000000
1980000000
1970000000
1960000000
1950000000
1940000000
1930000000
1920000000
1910000000
1900000000
1890000000
1880000000
1870000000
1860000000
1850000000
1840000000
1830000000
1820000000
1810000000
1800000000
1500000000
1490000000
1480000000
1470000000
1460000000
1450000000
1440000000
1430000000
1420000000
1410000000
1400000000
1390000000
1380000000
1370000000
1360000000
1350000000
1340000000
1330000000
1320000000
1310000000
1300000000
1290000000
860000000
570000000
560000000
550000000
540000000
530000000
520000000
510000000
500000000
490000000
480000000
470000000
460000000
450000000
440000000
430000000
420000000
410000000
400000000
390000000
40000000
30000000
20000000
10000000
0`
const splitCount = 1000
const step = 10000000 / splitCount
let b = []
a.split('\n')
.map(i => Number(i))
.forEach(n => {
for (let i = splitCount; i > 0; i--) {
b.push(Number(n) + (i - 1) * step)
}
});
console.log(b.join('\n'))

File diff suppressed because it is too large Load Diff

View File

@ -1,232 +1,43 @@
cd tools/netease_music/
# 服务器正在跑
# # node index --utils lyric --min 1940000000 --limit 10000 &
node index --utils lyric --min 1930000000 --max 1940000000 --limit 10000 &
# node index --utils lyric --min 1930000000 --max 1937000000 --limit 10000 --order desc &
node index --utils lyric --min 1920000000 --max 1930000000 --limit 10000 &
# node index --utils lyric --min 1920000000 --max 1927000000 --limit 10000 --order desc &
node index --utils lyric --min 1910000000 --max 1920000000 --limit 10000 &
# node index --utils lyric --min 1910000000 --max 1917000000 --limit 10000 --order desc &
node index --utils lyric --min 1900000000 --max 1910000000 --limit 10000 &
# node index --utils lyric --min 1900000000 --max 1907000000 --limit 10000 --order desc &
node index --utils lyric --min 1890000000 --max 1900000000 --limit 10000 &
node index --utils lyric --min 1880000000 --max 1890000000 --limit 10000 &
node index --utils lyric --min 1870000000 --max 1880000000 --limit 10000 &
# node index --utils lyric --min 1870000000 --max 1875000000 --limit 10000 --order desc &
node index --utils lyric --min 1860000000 --max 1870000000 --limit 10000 &
# node index --utils lyric --min 1860000000 --max 1865000000 --limit 10000 --order desc &
# node index --utils lyric --min 1940000000 --limit 10000 &
# node index --utils lyric --min 1930000000 --max 1940000000 --limit 10000 &
# node index --utils lyric --min 1920000000 --max 1930000000 --limit 10000 &
# node index --utils lyric --min 1910000000 --max 1920000000 --limit 10000 &
# node index --utils lyric --min 1900000000 --max 1910000000 --limit 10000 &
# node index --utils lyric --min 1890000000 --max 1900000000 --limit 10000 &
# node index --utils lyric --min 1880000000 --max 1890000000 --limit 10000 &
# node index --utils lyric --min 1870000000 --max 1880000000 --limit 10000 &
# node index --utils lyric --min 1860000000 --max 1870000000 --limit 10000 &
# node index --utils lyric --min 1850000000 --max 1860000000 --limit 10000 &
# node index --utils lyric --min 1840000000 --max 1850000000 --limit 10000 &
# node index --utils lyric --min 1830000000 --max 1840000000 --limit 10000 &
node index --utils lyric --min 1820000000 --max 1830000000 --limit 10000 &
# node index --utils lyric --min 1820000000 --max 1827000000 --limit 10000 --order desc &
node index --utils lyric --min 1810000000 --max 1820000000 --limit 10000 &
# node index --utils lyric --min 1810000000 --max 1817000000 --limit 10000 --order desc &
node index --utils lyric --min 1800000000 --max 1810000000 --limit 10000 &
# node index --utils lyric --min 1800000000 --max 1807000000 --limit 10000 --order desc &
# node index --utils lyric --min 1820000000 --max 1830000000 --limit 10000 &
# node index --utils lyric --min 1810000000 --max 1820000000 --limit 10000 &
# node index --utils lyric --min 1800000000 --max 1810000000 --limit 10000 &
# node index --utils lyric --min 1500000000 --max 1800000000 --limit 10000 &
node index --utils lyric --min 1490000000 --max 1500000000 --limit 10000 &
node index --utils lyric --min 1480000000 --max 1490000000 --limit 10000 &
node index --utils lyric --min 1470000000 --max 1480000000 --limit 10000 &
node index --utils lyric --min 1460000000 --max 1470000000 --limit 10000 &
node index --utils lyric --min 1450000000 --max 1460000000 --limit 10000 &
# node index --utils lyric --min 1450000000 --max 1455000000 --limit 10000 --order desc &
node index --utils lyric --min 1440000000 --max 1450000000 --limit 10000 &
# node index --utils lyric --min 1440000000 --max 1445000000 --limit 10000 --order desc &
node index --utils lyric --min 1430000000 --max 1440000000 --limit 10000 &
# node index --utils lyric --min 1430000000 --max 1435000000 --limit 10000 --order desc &
node index --utils lyric --min 1420000000 --max 1430000000 --limit 10000 &
# node index --utils lyric --min 1420000000 --max 1427000000 --limit 10000 --order desc &
node index --utils lyric --min 1410000000 --max 1420000000 --limit 10000 &
# node index --utils lyric --min 1410000000 --max 1417000000 --limit 10000 --order desc &
node index --utils lyric --min 1400000000 --max 1410000000 --limit 10000 &
# node index --utils lyric --min 1400000000 --max 1405000000 --limit 10000 --order desc &
node index --utils lyric --min 1390000000 --max 1400000000 --limit 10000 &
# node index --utils lyric --min 1390000000 --max 1395000000 --limit 10000 --order desc &
# node index --utils lyric --min 1490000000 --max 1500000000 --limit 10000 &
# node index --utils lyric --min 1480000000 --max 1490000000 --limit 10000 &
# node index --utils lyric --min 1470000000 --max 1480000000 --limit 10000 &
# node index --utils lyric --min 1460000000 --max 1470000000 --limit 10000 &
# node index --utils lyric --min 1450000000 --max 1460000000 --limit 10000 &
# node index --utils lyric --min 1440000000 --max 1450000000 --limit 10000 &
# node index --utils lyric --min 1430000000 --max 1440000000 --limit 10000 &
# node index --utils lyric --min 1420000000 --max 1430000000 --limit 10000 &
# node index --utils lyric --min 1410000000 --max 1420000000 --limit 10000 &
# node index --utils lyric --min 1400000000 --max 1410000000 --limit 10000 &
# node index --utils lyric --min 1390000000 --max 1400000000 --limit 10000 &
# node index --utils lyric --min 1380000000 --max 1390000000 --limit 10000 &
node index --utils lyric --min 1370000000 --max 1380000000 --limit 10000 &
# node index --utils lyric --min 1370000000 --max 1377000000 --limit 10000 --order desc &
node index --utils lyric --min 1360000000 --max 1370000000 --limit 10000 &
# node index --utils lyric --min 1360000000 --max 1367000000 --limit 10000 --order desc &
node index --utils lyric --min 1350000000 --max 1360000000 --limit 10000 &
# node index --utils lyric --min 1350000000 --max 1357000000 --limit 10000 --order desc &
node index --utils lyric --min 1340000000 --max 1350000000 --limit 10000 &
# node index --utils lyric --min 1340000000 --max 1347000000 --limit 10000 --order desc &
node index --utils lyric --min 1330000000 --max 1340000000 --limit 10000 &
# node index --utils lyric --min 1330000000 --max 1337000000 --limit 10000 --order desc &
node index --utils lyric --min 1320000000 --max 1330000000 --limit 10000 &
# node index --utils lyric --min 1320000000 --max 1327000000 --limit 10000 --order desc &
node index --utils lyric --min 1310000000 --max 1320000000 --limit 10000 &
# node index --utils lyric --min 1310000000 --max 1317000000 --limit 10000 --order desc &
node index --utils lyric --min 1300000000 --max 1310000000 --limit 10000 &
# node index --utils lyric --min 1300000000 --max 1305000000 --limit 10000 --order desc &
# 本地正在跑
# node index --utils lyric --min 570000000 --max 1300000000 --limit 10000
start cmd /k "node index --utils lyric --min 560000000 --max 570000000 --limit 10000"
start cmd /k "node index --utils lyric --min 550000000 --max 560000000 --limit 10000"
start cmd /k "node index --utils lyric --min 540000000 --max 550000000 --limit 10000"
# node index --utils lyric --min 530000000 --max 540000000 --limit 10000
# 本地正在跑
start cmd /k "node index --utils lyric --min 560000000 --max 570000000 --limit 10000 --order desc"
# 服务器正在跑
node index --utils lyric --min 1937000000 --max 1940000000 --limit 10000 --order desc &
node index --utils lyric --min 1927000000 --max 1930000000 --limit 10000 --order desc &
node index --utils lyric --min 1917000000 --max 1920000000 --limit 10000 --order desc &
node index --utils lyric --min 1907000000 --max 1910000000 --limit 10000 --order desc &
node index --utils lyric --min 1897000000 --max 1900000000 --limit 10000 --order desc &
node index --utils lyric --min 1887000000 --max 1890000000 --limit 10000 --order desc &
node index --utils lyric --min 1877000000 --max 1880000000 --limit 10000 --order desc &
node index --utils lyric --min 1867000000 --max 1870000000 --limit 10000 --order desc &
node index --utils lyric --min 1827000000 --max 1830000000 --limit 10000 --order desc &
node index --utils lyric --min 1817000000 --max 1820000000 --limit 10000 --order desc &
node index --utils lyric --min 1807000000 --max 1810000000 --limit 10000 --order desc &
node index --utils lyric --min 1497000000 --max 1500000000 --limit 10000 --order desc &
node index --utils lyric --min 1487000000 --max 1490000000 --limit 10000 --order desc &
node index --utils lyric --min 1477000000 --max 1480000000 --limit 10000 --order desc &
node index --utils lyric --min 1467000000 --max 1470000000 --limit 10000 --order desc &
node index --utils lyric --min 1457000000 --max 1460000000 --limit 10000 --order desc &
node index --utils lyric --min 1447000000 --max 1450000000 --limit 10000 --order desc &
node index --utils lyric --min 1437000000 --max 1440000000 --limit 10000 --order desc &
node index --utils lyric --min 1427000000 --max 1430000000 --limit 10000 --order desc &
node index --utils lyric --min 1417000000 --max 1420000000 --limit 10000 --order desc &
node index --utils lyric --min 1407000000 --max 1410000000 --limit 10000 --order desc &
node index --utils lyric --min 1397000000 --max 1400000000 --limit 10000 --order desc &
node index --utils lyric --min 1377000000 --max 1380000000 --limit 10000 --order desc &
node index --utils lyric --min 1367000000 --max 1370000000 --limit 10000 --order desc &
node index --utils lyric --min 1357000000 --max 1360000000 --limit 10000 --order desc &
node index --utils lyric --min 1347000000 --max 1350000000 --limit 10000 --order desc &
node index --utils lyric --min 1337000000 --max 1340000000 --limit 10000 --order desc &
node index --utils lyric --min 1327000000 --max 1330000000 --limit 10000 --order desc &
node index --utils lyric --min 1317000000 --max 1320000000 --limit 10000 --order desc &
node index --utils lyric --min 1307000000 --max 1310000000 --limit 10000 --order desc &
# 右边
# node index --utils lyric --min 1937000000 --max 1940000000 --limit 10000 --order asc &
# node index --utils lyric --min 1927000000 --max 1930000000 --limit 10000 --order asc &
# node index --utils lyric --min 1917000000 --max 1920000000 --limit 10000 --order asc &
# node index --utils lyric --min 1907000000 --max 1910000000 --limit 10000 --order asc &
# node index --utils lyric --min 1897000000 --max 1900000000 --limit 10000 --order asc &
# node index --utils lyric --min 1887000000 --max 1890000000 --limit 10000 --order asc &
# node index --utils lyric --min 1877000000 --max 1880000000 --limit 10000 --order asc &
# node index --utils lyric --min 1867000000 --max 1870000000 --limit 10000 --order asc &
# node index --utils lyric --min 1827000000 --max 1830000000 --limit 10000 --order asc &
# node index --utils lyric --min 1817000000 --max 1820000000 --limit 10000 --order asc &
# node index --utils lyric --min 1807000000 --max 1810000000 --limit 10000 --order asc &
# node index --utils lyric --min 1497000000 --max 1500000000 --limit 10000 --order asc &
# node index --utils lyric --min 1487000000 --max 1490000000 --limit 10000 --order asc &
# node index --utils lyric --min 1477000000 --max 1480000000 --limit 10000 --order asc &
# node index --utils lyric --min 1467000000 --max 1470000000 --limit 10000 --order asc &
# node index --utils lyric --min 1457000000 --max 1460000000 --limit 10000 --order asc &
# node index --utils lyric --min 1447000000 --max 1450000000 --limit 10000 --order asc &
# node index --utils lyric --min 1437000000 --max 1440000000 --limit 10000 --order asc &
# node index --utils lyric --min 1427000000 --max 1430000000 --limit 10000 --order asc &
# node index --utils lyric --min 1417000000 --max 1420000000 --limit 10000 --order asc &
# node index --utils lyric --min 1407000000 --max 1410000000 --limit 10000 --order asc &
# node index --utils lyric --min 1397000000 --max 1400000000 --limit 10000 --order asc &
# node index --utils lyric --min 1377000000 --max 1380000000 --limit 10000 --order asc &
# node index --utils lyric --min 1367000000 --max 1370000000 --limit 10000 --order asc &
# node index --utils lyric --min 1357000000 --max 1360000000 --limit 10000 --order asc &
# node index --utils lyric --min 1347000000 --max 1350000000 --limit 10000 --order asc &
# node index --utils lyric --min 1337000000 --max 1340000000 --limit 10000 --order asc &
# node index --utils lyric --min 1327000000 --max 1330000000 --limit 10000 --order asc &
# node index --utils lyric --min 1317000000 --max 1320000000 --limit 10000 --order asc &
# node index --utils lyric --min 1307000000 --max 1310000000 --limit 10000 --order asc &
# 服务器正在跑
node index --utils lyric --min 1895000000 --max 1897000000 --limit 10000 --order desc &
node index --utils lyric --min 1885000000 --max 1887000000 --limit 10000 --order desc &
node index --utils lyric --min 1875000000 --max 1877000000 --limit 10000 --order desc &
node index --utils lyric --min 1865000000 --max 1867000000 --limit 10000 --order desc &
node index --utils lyric --min 1495000000 --max 1497000000 --limit 10000 --order desc &
node index --utils lyric --min 1485000000 --max 1487000000 --limit 10000 --order desc &
node index --utils lyric --min 1475000000 --max 1477000000 --limit 10000 --order desc &
node index --utils lyric --min 1465000000 --max 1467000000 --limit 10000 --order desc &
node index --utils lyric --min 1455000000 --max 1457000000 --limit 10000 --order desc &
node index --utils lyric --min 1445000000 --max 1447000000 --limit 10000 --order desc &
node index --utils lyric --min 1435000000 --max 1437000000 --limit 10000 --order desc &
node index --utils lyric --min 1405000000 --max 1407000000 --limit 10000 --order desc &
node index --utils lyric --min 1395000000 --max 1397000000 --limit 10000 --order desc &
node index --utils lyric --min 1305000000 --max 1307000000 --limit 10000 --order desc &
# 右边
# node index --utils lyric --min 1895000000 --max 1897000000 --limit 10000 --order asc &
# node index --utils lyric --min 1885000000 --max 1887000000 --limit 10000 --order asc &
# node index --utils lyric --min 1875000000 --max 1877000000 --limit 10000 --order asc &
# node index --utils lyric --min 1865000000 --max 1867000000 --limit 10000 --order asc &
# node index --utils lyric --min 1495000000 --max 1497000000 --limit 10000 --order asc &
# node index --utils lyric --min 1485000000 --max 1487000000 --limit 10000 --order asc &
# node index --utils lyric --min 1475000000 --max 1477000000 --limit 10000 --order asc &
# node index --utils lyric --min 1465000000 --max 1467000000 --limit 10000 --order asc &
# node index --utils lyric --min 1455000000 --max 1457000000 --limit 10000 --order asc &
# node index --utils lyric --min 1445000000 --max 1447000000 --limit 10000 --order asc &
# node index --utils lyric --min 1435000000 --max 1437000000 --limit 10000 --order asc &
# node index --utils lyric --min 1405000000 --max 1407000000 --limit 10000 --order asc &
# node index --utils lyric --min 1395000000 --max 1397000000 --limit 10000 --order asc &
# node index --utils lyric --min 1305000000 --max 1307000000 --limit 10000 --order asc &
# 服务器正在跑
node index --utils lyric --min 1890000000 --max 1895000000 --limit 10000 --order desc &
node index --utils lyric --min 1880000000 --max 1885000000 --limit 10000 --order desc &
node index --utils lyric --min 1490000000 --max 1495000000 --limit 10000 --order desc &
node index --utils lyric --min 1480000000 --max 1485000000 --limit 10000 --order desc &
node index --utils lyric --min 1470000000 --max 1475000000 --limit 10000 --order desc &
node index --utils lyric --min 1460000000 --max 1465000000 --limit 10000 --order desc &
# 右边
# node index --utils lyric --min 1890000000 --max 1895000000 --limit 10000 --order asc &
# node index --utils lyric --min 1880000000 --max 1885000000 --limit 10000 --order asc &
# node index --utils lyric --min 1490000000 --max 1495000000 --limit 10000 --order asc &
# node index --utils lyric --min 1480000000 --max 1485000000 --limit 10000 --order asc &
# node index --utils lyric --min 1470000000 --max 1475000000 --limit 10000 --order asc &
# node index --utils lyric --min 1460000000 --max 1465000000 --limit 10000 --order asc &
# 手机正在跑
cd tools/netease_music/
# node index --utils lyric --min 1892000000 --max 1893000000 --limit 10000 --order desc &
node index --utils lyric --min 1882000000 --max 1883000000 --limit 10000 --order desc &
node index --utils lyric --min 1492000000 --max 1493000000 --limit 10000 --order desc &
node index --utils lyric --min 1482000000 --max 1483000000 --limit 10000 --order desc &
node index --utils lyric --min 1472000000 --max 1473000000 --limit 10000 --order desc &
node index --utils lyric --min 1462000000 --max 1463000000 --limit 10000 --order desc &
# node index --utils lyric --min 1370000000 --max 1380000000 --limit 10000 &
# node index --utils lyric --min 1360000000 --max 1370000000 --limit 10000 &
# node index --utils lyric --min 1350000000 --max 1360000000 --limit 10000 &
# node index --utils lyric --min 1340000000 --max 1350000000 --limit 10000 &
# node index --utils lyric --min 1330000000 --max 1340000000 --limit 10000 &
# node index --utils lyric --min 1320000000 --max 1330000000 --limit 10000 &
# node index --utils lyric --min 1310000000 --max 1320000000 --limit 10000 &
# node index --utils lyric --min 1300000000 --max 1310000000 --limit 10000 &
# node index --utils lyric --min 570000000 --max 1300000000 --limit 10000 &
# node index --utils lyric --min 560000000 --max 570000000 --limit 10000 &
# node index --utils lyric --min 550000000 --max 560000000 --limit 10000 &
# node index --utils lyric --min 540000000 --max 550000000 --limit 10000 &
# node index --utils lyric --min 530000000 --max 540000000 --limit 10000 &

View File

@ -74,7 +74,9 @@ async function fetch({ songId }) {
try {
// console.log(progress, queryParams);
// console.log("await comment_music")
var commentResult = await comment_music(queryParams);
// console.log("finish await comment_music")
// fs.writeFileSync(path.join(__dirname, "../../temp", `comment-${songId}-${pageCount}.json`), JSON.stringify(commentResult));
} catch (errors) {
console.error("error", errors);
@ -97,7 +99,7 @@ async function fetch({ songId }) {
// console.log(commentInfoList);
// console.log(userInfoList);
// console.log("dataManager.comment.insertCollection & dataManager.user.insertCollection")
console.log("dataManager.comment.insertCollection & dataManager.user.insertCollection")
let p1 = dataManager.comment.insertCollection(commentInfoList.map(commentInfo => [
commentInfo.comment_id,
commentInfo.parent_comment_id,
@ -149,10 +151,10 @@ async function fetch({ songId }) {
current_status: progress.currentStatus,
total: progress.total,
};
// console.log("dataManager.comment_progress.update")
console.log("dataManager.comment_progress.update")
let p3 = dataManager.comment_progress.update(commentProgressInfo, songId);
// console.log("UPDATE comment_progress");
await p3
// console.log("UPDATE comment_progress");
// console.log("sleepUtils.sleep")
// await sleepUtils.sleep(global.sleepTime);

View File

@ -28,8 +28,16 @@ async function fetchTop({ args = {} }) {
let hasMore = true;
while (hasMore) {
try {
// var result = await top_playlist({ id: 1 });
var result = await top_playlist_highquality({ id: 1 });
// https://neteasecloudmusicapi-docs.4everland.app/#/?id=%e6%ad%8c%e5%8d%95-%e7%bd%91%e5%8f%8b%e7%b2%be%e9%80%89%e7%a2%9f-
var result = await top_playlist({ id: 2 });
// https://neteasecloudmusicapi-docs.4everland.app/#/?id=%e8%8e%b7%e5%8f%96%e7%b2%be%e5%93%81%e6%ad%8c%e5%8d%95
// var result = await top_playlist_highquality({});
// 调用此接口,传入歌单 id 可获取相关歌单
// https://neteasecloudmusicapi-docs.4everland.app/#/?id=%e7%9b%b8%e5%85%b3%e6%ad%8c%e5%8d%95%e6%8e%a8%e8%8d%90
var result = await related_playlist({ id: 809945533 });
// fs.writeFileSync(path.join(__dirname, "../../temp", `test.json`), JSON.stringify(result.body));
} catch (errors) {
console.error("error", errors);
@ -47,7 +55,7 @@ async function fetchTop({ args = {} }) {
await global.checkIsExit();
const playlist = playlists[i];
const playlistId = playlist.id;
console.log(`${i + 1}/${playlists.length} | playlist: ${playlistId} | limit: ${limit}, page: ${page}`);
console.log(`${Number(i) + 1}/${playlists.length} | playlist: ${playlistId} | limit: ${limit}, page: ${page}`);
try {
await oldPlaylistUtils.fetch({ playlistId: playlist.id })
} catch (err) {
@ -55,6 +63,8 @@ async function fetchTop({ args = {} }) {
}
// await sleepUtils.sleep(global.sleepTime);
}
// 更新 is_fetched_related_playlist 字段
}
}

View File

@ -0,0 +1,40 @@
// const mysql = require('mysql');
// await new Promise(function (resolve, reject) {
// //通过MySQL中方法创建连接对象
// var connection = mysql.createConnection({
// "charset": "utf8mb4",
// "host": "localhost",
// "user": "root",
// "password": "123456",
// "port": 3306,
// "database": ""
// });
// //开始连接
// connection.connect();
// var sql = `
// INSERT INTO comment ( comment_id, parent_comment_id, user_id, song_id, content, time, like_count, comment_type ) VALUES ?
// ON DUPLICATE KEY UPDATE content = VALUES(content), like_count = VALUES(like_count), comment_type = GREATEST(comment_type, VALUES(comment_type)), modify_time = CURRENT_TIMESTAMP
// `;
// var params = commentInfoList.map(commentInfo => [
// commentInfo.comment_id,
// commentInfo.parent_comment_id,
// commentInfo.user_id,
// commentInfo.song_id,
// commentInfo.content,
// commentInfo.time,
// commentInfo.like_count,
// commentInfo.comment_type
// ]);
// var formattedSql = connection.format(sql, [params]); // 返回一个格式化后的SQL字符串
// console.log(params); // 打印原始SQL语句
// console.log(formattedSql); // 打印原始SQL语句
// //最后需要关闭连接
// connection.end();
// });
// process.exit(0);
// node index --utils comment --min 1935500000 --max 1935550000 --limit 10

View File

@ -0,0 +1,9 @@
REPLACE INTO `comment_origin_` SELECT * FROM `comment`; -- 80.1G
REPLACE INTO `user_origin_` SELECT * FROM `user`; -- 5.20G
DELETE `comment`
FROM `comment` INNER JOIN `comment_origin_` ON `comment`.comment_id = `comment_origin_`.comment_id;
DELETE `user`
FROM `user` INNER JOIN `user_origin_` ON `user`.user_id = `user_origin_`.user_id;

6
xiaoeknow/README.md Normal file
View File

@ -0,0 +1,6 @@
# 小鹅通课程下载脚本
https://xiaoeknow.com/
https://xiaoe-tech.com/
https://study.xiaoe-tech.com/

View File

@ -0,0 +1,3 @@
*.json
*.txt
*.csv

View File

@ -0,0 +1,229 @@
const request = require('request');
const fs = require('fs');
const path = require('path');
// 2023.06.27
// https://appe0mes6qx8480.h5.xiaoeknow.com/p/course/member/p_5857d53b3342a_Tm6TjjTD?type=3
function getResult(pageIndex) {
var options = {
'method': 'POST',
'url': 'https://appe0mes6qx8480.h5.xiaoeknow.com/xe.course.business.member.single_items.get/2.0.0',
'headers': {
'authority': 'appe0mes6qx8480.h5.xiaoeknow.com',
'accept': 'application/json, text/plain, */*',
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'content-type': 'application/x-www-form-urlencoded',
'cookie': 'sajssdk_2015_cross_new_user=1; sensorsdata2015jssdkcross=%7B%22%24device_id%22%3A%22188910ca4534a7-06c3769156869f-7e56547a-1638720-188910ca45483b%22%2C%22distinct_id%22%3A%22188faad51401330-0a45aeaa8b8e44-7e56547a-1638720-188faad5141188b%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%7D; Hm_lvt_32573db0e6d7780af79f38632658ed95=1687832846; Hm_lpvt_32573db0e6d7780af79f38632658ed95=1687832846; Qs_lvt_416447=1687832846; Qs_pv_416447=2667293149066936000; shop_version_type=4; ko_token=1242be138fd55c4ef4316cd54334b65c; xenbyfpfUnhLsdkZbX=0; dataUpJssdkCookie={"wxver":"","net":"","sid":""}; sajssdk_2015_new_user_appe0mes6qx8480_h5_xiaoeknow_com=1; sa_jssdk_2015_appe0mes6qx8480_h5_xiaoeknow_com=%7B%22distinct_id%22%3A%22u_6493fd71d1df1_FjNmN1cb6S%22%2C%22first_id%22%3A%22188faae9cb032a-042220d4e5b0b6-7e56547a-1638720-188faae9cb11002%22%2C%22props%22%3A%7B%7D%7D; logintime=1687833065; logintime=1687833334; shop_version_type=4',
'origin': 'https://appe0mes6qx8480.h5.xiaoeknow.com',
'referer': 'https://appe0mes6qx8480.h5.xiaoeknow.com/p/course/member/p_5857d53b3342a_Tm6TjjTD?type=3',
'req-uuid': '20230627103104000260393',
'retry': '1',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.51'
},
form: {
'bizData[column_id]': 'p_5857d53b3342a_Tm6TjjTD',
'bizData[page_index]': `${pageIndex}`,
// 'bizData[page_index]': '1',
'bizData[page_size]': '100',
'bizData[sort]': 'asc'
}
}
request(options, function (error, response) {
if (error) throw new Error(error)
console.log(response.body)
let result = JSON.parse(response.body)
let data = result.data
if (result.code === 0) {
fs.writeFileSync(path.join(__dirname, 'courseList', `${pageIndex}.json`), JSON.stringify(data), 'utf-8')
}
})
}
// // step 1: get course list
// for (let pageIndex = 1; pageIndex <= 23; pageIndex++) {
// getResult(pageIndex)
// }
// // step 2: parse course list
// let total = []
// for (let pageIndex = 1; pageIndex <= 23; pageIndex++) {
// let jsonStr = fs.readFileSync(path.join(__dirname, 'courseList', `${pageIndex}.json`), 'utf-8')
// let json = JSON.parse(jsonStr)
// total.push(...json.list)
// }
// console.log(total.length)
// fs.writeFileSync(path.join(__dirname, 'courseList', `index.json`), JSON.stringify({
// "total": total.length,
// "list": total,
// }), 'utf-8')
// step 3: fetch course detail
let jsonStr = fs.readFileSync(path.join(__dirname, 'courseList', `index.json`), 'utf-8')
let json = JSON.parse(jsonStr)
let courseList = json.list
getDetails()
async function getDetails() {
getDetails1(courseList.filter(course => course.resource_type === 1))
getDetails3(courseList.filter(course => course.resource_type === 3))
getDetails24(courseList.filter(course => course.resource_type === 2 || course.resource_type === 4))
}
async function getDetails1(courseList) {
// "resource_type": 1, 图文
}
async function getDetails3(courseList) {
// "resource_type": 3, 视频
// 年终秀PPT动态视频
// jump_url: /content_page/eyJ0eXBlIjoyLCJyZXNvdXJjZV90eXBlIjozLCJyZXNvdXJjZV9pZCI6InZfNWZlY2VjMDhlNGIwYzRmMmJjNGYxYmJkIiwicHJvZHVjdF9pZCI6InBfNTg1N2Q1M2IzMzQyYV9UbTZUampURCIsImFwcF9pZCI6ImFwcGUwTUVzNnFYODQ4MCJ9
//
// 打开页面 读 html 代码发现参数添加 showVconsole 可以打开右下角 vConsole
// 然后发现通过 打印多媒体元素 打印出来的那条记录的 <video> 标签存在 currentSrc 属性
// document.querySelector('video').currentSrc
}
async function getDetails24(courseList) {
// "resource_type": 2 / 4, 音频
// "resource_type": 2,
// 万科的下场
// jump_url: /content_page/eyJ0eXBlIjoyLCJyZXNvdXJjZV90eXBlIjoyLCJyZXNvdXJjZV9pZCI6IjE3IiwicHJvZHVjdF9pZCI6InBfNTg1N2Q1M2IzMzQyYV9UbTZUampURCIsImFwcF9pZCI6ImFwcGUwTUVzNnFYODQ4MCJ9
// 拼接host: https://h5.xiaoeknow.com 或 https://appe0mes6qx8480.h5.xiaoeknow.com
// 最好拼接后面那个,因为前面那个还是会 302 到后面那个
// https://h5.xiaoeknow.com/content_page/eyJ0eXBlIjoyLCJyZXNvdXJjZV90eXBlIjoyLCJyZXNvdXJjZV9pZCI6IjE3IiwicHJvZHVjdF9pZCI6InBfNTg1N2Q1M2IzMzQyYV9UbTZUampURCIsImFwcF9pZCI6ImFwcGUwTUVzNnFYODQ4MCJ9
// 会 302 到 https://appe0mes6qx8480.h5.xiaoeknow.com/p/course/audio/17?product_id=p_5857d53b3342a_Tm6TjjTD
// "resource_type": 4,
// 0627【观点】过去日夜喧嚣的“创业大街”如今怎样了
// jump_url: /content_page/eyJ0eXBlIjoyLCJyZXNvdXJjZV90eXBlIjoyLCJyZXNvdXJjZV9pZCI6ImFfNjQ5OWE5MjllNGIwYjJkMWM0MjkxOTI2IiwicHJvZHVjdF9pZCI6InBfNTg1N2Q1M2IzMzQyYV9UbTZUampURCIsImFwcF9pZCI6ImFwcGUwTUVzNnFYODQ4MCJ9
// 会 302 到 https://appe0mes6qx8480.h5.xiaoeknow.com/p/course/audio/a_6499a929e4b0b2d1c4291926?product_id=p_5857d53b3342a_Tm6TjjTD
for (let courseIndex = 26 || 0; courseIndex < courseList.length; courseIndex++) {
const course = courseList[courseIndex]
// console.log(course)
// return
// 跟随重定向(需要传 Cookie 的 anony_token不然会重定向到自己。可以通过先访问一次拿到 set-cookie 再重新请求)
let result = await new Promise((resolve, reject) => {
var options = {
'method': 'GET',
'url': 'https://appe0mes6qx8480.h5.xiaoeknow.com' + course.jump_url,
// 'url': 'https://appe0mes6qx8480.h5.xiaoeknow.com/content_page/eyJ0eXBlIjoyLCJyZXNvdXJjZV90eXBlIjoyLCJyZXNvdXJjZV9pZCI6IjE3IiwicHJvZHVjdF9pZCI6InBfNTg1N2Q1M2IzMzQyYV9UbTZUampURCIsImFwcF9pZCI6ImFwcGUwTUVzNnFYODQ4MCJ9',
'headers': {
'Cookie': 'anony_token=9dcb10c78e3e237def2c69a3709d8d44'
},
followRedirect: false,
};
request(options, function (error, response) {
if (error) throw new Error(error);
// console.log(response.body);
//使用正则表达式匹配以https开头的网址可以使用以下方法
var regex = /\<title\>Redirecting to (.*?)\<\/title\>/g; //匹配以https开头的非空白字符直到遇到空白字符或字符串结束为止
var matches = regex.exec(response.body);
if (matches) {
console.log(matches[1]); //打印结果
// https://appe0mes6qx8480.h5.xiaoeknow.com/p/course/audio/17?product_id=p_5857d53b3342a_Tm6TjjTD
const url = matches[1]
var regex2 = /^.*?\/course\/audio\/(.*?)\?product_id=(.*?)$/g;
var matches2 = regex2.exec(url);
if (matches2) {
// console.log(matches2); //打印结果
const resource_id = matches2[1]
const product_id = matches2[2]
resolve({ resource_id, product_id })
}
}
resolve(null)
})
})
if (!result) {
console.log("失败1", courseIndex, course.resource_id)
fs.appendFileSync(path.join(__dirname, 'courseDetail', '24', `failed.txt`),
`失败1\t${courseIndex}\t${course.resource_id}\n`, 'utf-8')
continue
}
let result2 = await new Promise((resolve, reject) => {
var options = {
'method': 'POST',
'url': 'https://appe0mes6qx8480.h5.xiaoeknow.com/xe.course.business.audio.info.get/2.0.0',
'headers': {
'authority': 'appe0mes6qx8480.h5.xiaoeknow.com',
'accept': 'application/json, text/plain, */*',
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'content-type': 'application/x-www-form-urlencoded',
'cookie': 'sajssdk_2015_cross_new_user=1; sensorsdata2015jssdkcross=%7B%22%24device_id%22%3A%22188910ca4534a7-06c3769156869f-7e56547a-1638720-188910ca45483b%22%2C%22distinct_id%22%3A%22188faad51401330-0a45aeaa8b8e44-7e56547a-1638720-188faad5141188b%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%7D; Hm_lvt_32573db0e6d7780af79f38632658ed95=1687832846; Hm_lpvt_32573db0e6d7780af79f38632658ed95=1687832846; Qs_lvt_416447=1687832846; Qs_pv_416447=2667293149066936000; shop_version_type=4; ko_token=1242be138fd55c4ef4316cd54334b65c; xenbyfpfUnhLsdkZbX=0; dataUpJssdkCookie={"wxver":"","net":"","sid":""}; sajssdk_2015_new_user_appe0mes6qx8480_h5_xiaoeknow_com=1; sa_jssdk_2015_appe0mes6qx8480_h5_xiaoeknow_com=%7B%22distinct_id%22%3A%22u_6493fd71d1df1_FjNmN1cb6S%22%2C%22first_id%22%3A%22188faae9cb032a-042220d4e5b0b6-7e56547a-1638720-188faae9cb11002%22%2C%22props%22%3A%7B%7D%7D; logintime=1687834785; logintime=1687835002; shop_version_type=4',
'origin': 'https://appe0mes6qx8480.h5.xiaoeknow.com',
'referer': 'https://appe0mes6qx8480.h5.xiaoeknow.com/p/course/audio/a_6499a929e4b0b2d1c4291926?product_id=p_5857d53b3342a_Tm6TjjTD',
'req-uuid': '20230627105945000455932',
'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Microsoft Edge";v="114"',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.51'
},
form: {
'bizData[resource_id]': result.resource_id, // 'a_6499a929e4b0b2d1c4291926',
'bizData[product_id]': request.product_id, // 'p_5857d53b3342a_Tm6TjjTD',
'bizData[opr_sys]': 'Win32'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
// console.log(response.body);
/*
{
"code": 0,
"msg": "success",
"data": {
"audio_info": {
"title": "0627\u3010\u89c2\u70b9\u3011\u8fc7\u53bb\u65e5\u591c\u55a7\u56a3\u7684\u201c\u521b\u4e1a\u5927\u8857\u201d\uff0c\u5982\u4eca\u600e\u6837\u4e86\uff1f",
"audio_url": "https:\/\/wechatapppro-1252524126.file.myqcloud.com\/appe0MEs6qX8480\/audio_compressed\/1687791920_23nbypljczgd58.mp3",
"audio_size": 0,
"audio_length": 433,
"start_at": "2023-06-27 07:00:02",
"state": 0,
"sign_url": "",
"show_in_menu": 1,
"can_select": 1
},
"is_auto_play": 1,
"audio_back_listen_switch": 1,
"is_try": 0,
"payment_url": "",
"product_try_info": [],
"only_h5_play": 0,
"jump_h5_url": ""
},
"forward_url": ""
}
*/
let _result = JSON.parse(response.body)
if (_result.code === 0) {
// console.log(_result.data)
fs.appendFileSync(path.join(__dirname, 'courseDetail', '24', `index.csv`),
`${courseIndex}\t${result.resource_id}\t${_result.data?.audio_info?.start_at}\t${_result.data?.audio_info?.title}\t${_result.data?.audio_info?.audio_url}\n`, 'utf-8')
if (_result.data?.audio_info?.audio_url) {
fs.appendFileSync(path.join(__dirname, 'courseDetail', '24', `url.txt`),
`${_result.data?.audio_info?.audio_url}\n`, 'utf-8')
resolve()
return
}
}
console.log("失败2", courseIndex, course.resource_id)
fs.appendFileSync(path.join(__dirname, 'courseDetail', '24', `failed.txt`),
`失败2\t${courseIndex}\t${course.resource_id}\n`, 'utf-8')
});
})
}
}