-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
72,544 additions
and
494 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import resolve from '@rollup/plugin-node-resolve'; // 帮助寻找node_modules里的包 | ||
import commonjs from '@rollup/plugin-commonjs'; // 将非ES6语法的包转为ES6可用 | ||
import json from '@rollup/plugin-json'; | ||
import replace from '@rollup/plugin-replace'; | ||
import CONFIG from '../package.json'; | ||
import alias from '@rollup/plugin-alias'; | ||
|
||
export default [ | ||
alias({ | ||
entries: { | ||
'@tools': './package/tools', | ||
'@src': './src', | ||
'@plugins': './package/plugins', | ||
'@FakeServer': './package/FakeServer', | ||
}, | ||
}), | ||
replace({ | ||
preventAssignment: true, | ||
values: { | ||
__version__: JSON.stringify(CONFIG.version), | ||
__buildDate__: new Date().getTime(), | ||
'process.env.NODE_ENV': JSON.stringify('production'), | ||
}, | ||
}), | ||
json(), | ||
resolve({ | ||
jsnext: true, | ||
browser: true, | ||
}), | ||
commonjs(), // 将 CommonJS 转换成 ES2015 模块供 Rollup 处理 | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import('https://cdn.jsdelivr.net/npm/js-spider@3.2.3/dist/JSpider.esm.min.js').then(async (res) => { | ||
let JSpider = res.default; | ||
let { | ||
Plugin, | ||
plugins: { ExcelHelper, Request, Download, ZipFile, Combine }, | ||
} = JSpider; | ||
await JSpider.$load('xlsx'); | ||
await JSpider.$load('lodash'); | ||
await JSpider.$load('jszip'); | ||
let keyword = encodeURI('奥运'); | ||
|
||
let number = 36 || 744; | ||
const aid = '671cc434-cded-4123-aad8-be48a9b5a62e'; | ||
const searchID = '2021080820531701021203523228D85563'; | ||
let urls = [...Array(Math.ceil(number / 12)).keys()].map((i) => { | ||
return { | ||
url: `https://www.douyin.com/aweme/v1/web/search/item/?device_platform=webapp&aid=6383&channel=channel_pc_web&search_channel=aweme_video_web&sort_type=0&publish_time=0&keyword=${keyword}&search_source=normal_search&query_correct_type=1&is_filter_search=0&offset=${ | ||
i * 12 | ||
}&count=12&search_id=${searchID}&version_code=160100&version_name=16.1.0&cookie_enabled=true&screen_width=1536&screen_height=864&browser_language=zh-CN&browser_platform=Win32&browser_name=Mozilla&browser_version=5.0+(Windows+NT+10.0%3B+Win64%3B+x64)+AppleWebKit%2F537.36+(KHTML,+like+Gecko)+Chrome%2F92.0.4515.131+Safari%2F537.36+Edg%2F92.0.902.67&browser_online=true`, | ||
options: { | ||
headers: { | ||
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', | ||
'cache-control': 'no-cache', | ||
pragma: 'no-cache', | ||
'sec-ch-ua': '"Chromium";v="92", " Not A;Brand";v="99", "Microsoft Edge";v="92"', | ||
'sec-ch-ua-mobile': '?0', | ||
'sec-fetch-dest': 'empty', | ||
'sec-fetch-mode': 'cors', | ||
'sec-fetch-site': 'same-origin', | ||
withcredentials: 'true', | ||
}, | ||
referrer: `https://www.douyin.com/search/${keyword}?source=normal_search&aid=${aid}&enter_from=main_page`, | ||
credentials: 'include', | ||
}, | ||
}; | ||
}); | ||
let spider = new JSpider() | ||
.pipeline( | ||
Request({ | ||
delay: 1000, | ||
buffer: 1, | ||
}), | ||
Combine(50, 3000, (dataArray) => { | ||
debugger; | ||
return dataArray | ||
.map((i) => { | ||
return i.data | ||
.map((item) => item['aweme_info']) | ||
.map((item) => { | ||
return { | ||
author: item.author.nickname, | ||
count: item.statistics.digg_count, | ||
createTime: new Date(Number(item['create_time'] + '000')).toLocaleDateString(), | ||
}; | ||
}); | ||
}) | ||
.flat() | ||
.flat(); | ||
}), | ||
ExcelHelper((dataset) => { | ||
debugger; | ||
return { a: dataset }; | ||
}), | ||
Download(), | ||
) | ||
.crawl(urls) | ||
.start(); | ||
}); |
Oops, something went wrong.