diff --git a/README.md b/README.md new file mode 100644 index 0000000..936b88d --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Node版的爬虫工具 + +## 20190402 玛丽娱乐小程序抓取 + +sites/hoh8.js + + diff --git a/src/sites/hoh8.js b/src/sites/hoh8.js index 7b93ec1..ba533ee 100644 --- a/src/sites/hoh8.js +++ b/src/sites/hoh8.js @@ -4,6 +4,14 @@ import netUtil from '../utils/net.util'; let client = socketClient; +/** + * 玛丽娱乐 小程序数据爬取工具, 主要爬取电影和游戏,在run方法中打开或关闭对于代码 + * 须从小程序中获取uid和token + * + * */ + +const token = 'c402cdea067bb6d1ff51090edbe0d645'; +const uid = '2407044'; /** * 获取电影列表 * @param {Number} id 分页 从0开始 @@ -43,9 +51,9 @@ const getVideoToken = (id) => { } // 更新用户余额 -const updateMoney = async (appId, token, appName) => { +const updateMoney = async (appId, videoToken, appName) => { let url = 'https://game.hoh8.cn/hh/deal/getVideoADReward.anon'; - let jsonData = {"appId": appId,"appName":appName,"token":token,"userId":uid}; + let jsonData = {"appId": appId,"appName":appName,"token":videoToken,"userId":uid}; let data = { deviceType: 5, appVersion: 1, @@ -75,10 +83,10 @@ const parseAllRecord = async (type) => { let current = 0; let list = []; -let uid = '2407044'; + export default { run: function () { - let url = `wss://game.hoh8.cn/hh/websocket?userId=${uid}&token=c402cdea067bb6d1ff51090edbe0d645&roomId=0&groupId=global`; + let url = `wss://game.hoh8.cn/hh/websocket?userId=${uid}&token=${token}&roomId=0&groupId=global`; client.open(url, ''); client.onopen = (e) => { console.log('socket on open');