├── config ├── api └── account ├── .gitignore ├── package.json ├── README.md ├── app.js ├── LICENSE └── index.js /config/api: -------------------------------------------------------------------------------- 1 | https://api.littlecontrol.me 2 | -------------------------------------------------------------------------------- /config/account: -------------------------------------------------------------------------------- 1 | //your phone 2 | //your password 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | *.lock 3 | *prettierrc* 4 | Temp/ 5 | Test/ 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auto-netease-music", 3 | "version": "1.0.0", 4 | "main": "app.js", 5 | "repository": "https://github.com/LittleControl/AutoNeteaseMusic.git", 6 | "author": "littlecontrol", 7 | "license": "MIT", 8 | "type": "commonjs", 9 | "scripts": { 10 | "start": "npm run build && node index.js", 11 | "dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider npm run build && node index.js", 12 | "build": "babel app.js -o index.js" 13 | }, 14 | "babel": { 15 | "presets": [ 16 | [ 17 | "@babel/preset-env", 18 | { 19 | "useBuiltIns": "usage", 20 | "corejs": "3.18.3" 21 | } 22 | ] 23 | ] 24 | }, 25 | "prettier": { 26 | "tabWidth": 2, 27 | "semi": false, 28 | "singleQuote": true 29 | }, 30 | "dependencies": { 31 | "@types/node": "^16.10.9", 32 | "axios": "^0.23.0", 33 | "core-js": "^3.18.3", 34 | "libphonenumber-js": "^1.9.38", 35 | "regenerator-runtime": "^0.13.9" 36 | }, 37 | "devDependencies": { 38 | "@babel/cli": "^7.15.7", 39 | "@babel/core": "^7.15.8", 40 | "@babel/plugin-transform-regenerator": "^7.14.5", 41 | "@babel/preset-env": "^7.15.8", 42 | "cross-env": "^7.0.3" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutoNeteaseMusic 2 | 3 | 网易云音乐自动打卡刷每日推荐歌曲及歌单云函数 4 | 5 | ## 关于 6 | 7 | - 本项目后端基于[NeteaseCloudMusicApi](https://github.com/Binaryify/NeteaseCloudMusicApi) 8 | - 由于 Vercel 免费额度问题,先已不再提供搭建好的后端 API,还请自行搭建,搭建步骤还请参考[NeteaseCloudMusicApi 在 vercel 上的部署](https://neteasecloudmusicapi.vercel.app/#/?id=vercel-%e9%83%a8%e7%bd%b2),当然也不必非局限于 Vercel 这个平台 9 | - 经过我一周工作的摸鱼时间,写出了这个项目,代码写的确实烂,还请见谅 10 | - 因为没有`Node.js`的较为大型项目开发经验,所以好多代码确实辣眼睛,还请不吝赐教 11 | 12 | ## 已实现的功能 13 | 14 | - [x] 自动打卡签到,包括 PC 端(网页端)和安卓端,以及云贝签到 15 | - [x] 自动刷歌,每日推荐歌曲以及每日推荐歌单里面的歌曲 16 | - [x] 多国手机号登陆支持 17 | - [x] 适配相关云平台日志输出,其实就是加了一些`console.log`并`try-catch`了一下 18 | - [x] 多账号功能支持 19 | 20 | ## 待实现的功能(~~已提上日程~~) 21 | 22 | - [ ] 使用 Github Action 完成一些自动化功能,以及进行 release 缩容等 23 | - [ ] 英文版 README,B 格一定要有,就当学习英语了 24 | - [ ] 运行失败时重复运行功能, 防止单次运行失败 25 | - [ ] Feature or BUG 请提 issues, 随缘支撑 26 | - [ ] 邮件登录方式支持 27 | 28 | ## 使用方法 29 | 30 | 1. 下载 release 页面压缩包,或者`clone`代码,自己安装 npm 依赖 31 | 2. 登陆云平台,(腾讯云,阿里云等),进入云函数页面,并新建一个云函数 32 | 3. 函数环境选择 nodejs 的最新版本(推荐 14.x, 16.x 也可以, 都测试通过),函数入口填`index.main`,内存选择`128MB`,超时时间填入`600`即可 33 | 4. 然后将代码上传到平台(注意, 压缩包一级目录即为代码目录, 参考下载的 release 压缩包内容),修改`config/account`,第一行为自己的网易云绑定的手机号,第二行为对应的明文密码,如果手机号为国内号码,则直接填入号码即可,不需要加区域码,但如果是国外手机号,则必须加区域码,比如美国手机号`+1xxxxxxx`.如果有多个账号,则按照格式,比如第一行为账号,第二行为密码,第三行为账号,第四行为密码,以此类推 34 | 5. 修改`config/api`文件内容为自己的 API 地址,默认我已经搭好的地址(该地址已失效),建议使用自己的 API 地址,具体搭建参考[NeteaseCloudMusicApi](https://neteasecloudmusicapi.vercel.app/#/?id=vercel-%e9%83%a8%e7%bd%b2)在 vercel 上的部署 35 | 6. 部署函数并测试,查看日志定位原因 36 | 7. 设置触发器,触发器就是根据你设定的条件自动执行函数,选择时间触发器,然后你可以根据提示设置,好像有的是要填 cron 表达式啥的,比如` 0 0 4 * * *`,这个就是北京时间每天`12:00`执行,具体的可以自己研究一下表达式该怎么写 37 | 8. 保存,并开始摸鱼 38 | 39 | ## 其他 40 | 41 | - 当前腾讯云和阿里云似乎均不再提供免费云函数额度,还请留意(建议阿里云按量付费) 42 | - 由于 Vercle 的国内环境, 网络可能不是很稳定, 建议触发器一天设置多个触发点, 防止一次运行失败, 后续会加入失败重启功能 43 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import path from 'path' 3 | import parsePhoneNumber from 'libphonenumber-js' 4 | import { promises } from 'fs' 5 | const { readFile } = promises 6 | 7 | const CONFIG_DIR = path.join(__dirname, 'config') 8 | const INFO = { 9 | api: undefined, 10 | cookies: [], 11 | accounts: [], 12 | } 13 | 14 | /** 15 | * @description: 获取api 16 | */ 17 | const getLocalApi = async (dir) => { 18 | let api 19 | try { 20 | const content = await readFile(`${dir}/api`, 'utf-8') 21 | api = content.replace(/[\s]/g, '') 22 | } catch (error) { 23 | console.log('读取本地API配置失败,使用默认的API配置') 24 | api = 'https://api.littlecontrol.me' 25 | } 26 | return api 27 | } 28 | 29 | /** 30 | * @description: 通过手机号登陆,获取Cookie 31 | */ 32 | const getCookies = async (dir, info) => { 33 | if (!info.api) { 34 | info.api = await getLocalApi(dir) 35 | } 36 | const url = `${info.api}/login/cellphone` 37 | try { 38 | const accounts = await getAccountInfo(dir) 39 | info.accounts = accounts 40 | const cookies = await Promise.all( 41 | accounts.map(async (current) => { 42 | const { data } = await axios({ 43 | method: 'POST', 44 | url, 45 | data: { 46 | phone: current.phone, 47 | password: current.password, 48 | countrycode: current.countrycode, 49 | }, 50 | }) 51 | console.log(current.phone.slice(-4) + '登陆成功') 52 | return data?.cookie 53 | }) 54 | ) 55 | return cookies 56 | } catch (error) { 57 | console.log('获取Cookie失败') 58 | console.log(error?.response) 59 | console.log(error?.response?.data) 60 | return [] 61 | } 62 | } 63 | 64 | /** 65 | * @description: 从文件读取账户信息 66 | */ 67 | const getAccountInfo = async (dir) => { 68 | const res = [] 69 | try { 70 | const fileContent = await readFile(`${dir}/account`, 'utf-8') 71 | const contentArr = fileContent.replace(/[\t\r ]/g, '').split('\n') 72 | contentArr.forEach((current, index, array) => { 73 | if (index % 2 === 0) { 74 | if (current === '') return 75 | const parsedNumber = parsePhoneNumber(current, 'CN') 76 | res.push({ 77 | phone: parsedNumber?.formatNational().replace(/[()\s-]/g, ''), 78 | countrycode: parsedNumber?.countryCallingCode, 79 | password: array[index + 1], 80 | }) 81 | } 82 | }) 83 | return res 84 | } catch (error) { 85 | console.log('读取用户账户密码失败') 86 | return [] 87 | } 88 | } 89 | 90 | /** 91 | * @description: 拦截请求,添加cookie等信息 92 | */ 93 | axios.interceptors.request.use( 94 | async (config) => { 95 | config.withCredentials = true 96 | //防止网易对IP的限制 97 | // config.headers['X-Real-IP'] = '10.0.23.143' 98 | const { method, url } = config 99 | config.params ??= {} 100 | // config.params.proxy='http://127.0.0.1:7890' 101 | config.params.realIP = '116.25.146.177' 102 | if (method?.toUpperCase() === 'POST') { 103 | config.params.timestamp = Date.now() 104 | } 105 | config.data ??= {} 106 | if (url?.includes('login')) { 107 | return config 108 | } 109 | config.data.cookie = INFO.cookies[0] 110 | // config.headers['Cookie'] = INFO.cookies[0] 111 | return config 112 | }, 113 | async (error) => { 114 | return Promise.reject(error) 115 | } 116 | ) 117 | 118 | /** 119 | * @description: 打卡签到 120 | */ 121 | const checkIn = async (api) => { 122 | const url = `${api}/daily_signin` 123 | let res = [] 124 | try { 125 | await axios({ 126 | method: 'POST', 127 | url, 128 | }) 129 | console.log('Android端签到完成') 130 | res.push('Android端签到完成') 131 | } catch (error) { 132 | console.log(`Android端签到失败`) 133 | console.log(error?.response?.data) 134 | res.push('Android端签到失败') 135 | } 136 | try { 137 | await axios({ 138 | method: 'POST', 139 | url, 140 | params: { 141 | type: 1, 142 | }, 143 | }) 144 | console.log('Web/PC端签到完成') 145 | res.push('Web/PC端签到完成') 146 | } catch (error) { 147 | console.log(`Web/PC端签到失败`) 148 | console.log(error?.response?.data) 149 | res.push('Web/PC端签到失败') 150 | } 151 | console.log('两个平台前端都会有云贝奖励,Android端默认也会进行云贝签到') 152 | console.log('请登陆网易云查看云贝奖励是否正常') 153 | return res 154 | } 155 | 156 | /** 157 | * @description: 获取每日推荐歌单 158 | */ 159 | const getDailyPlaylist = async (api) => { 160 | const url = `${api}/recommend/resource` 161 | try { 162 | const { data } = await axios({ 163 | method: 'POST', 164 | url, 165 | }) 166 | return data 167 | } catch (error) { 168 | console.log(`获取每日推荐歌单失败`) 169 | console.log(error?.response?.data) 170 | return {} 171 | } 172 | } 173 | 174 | /** 175 | * @description: 获取歌单详情 176 | */ 177 | const getPlaylistContent = async (id, api) => { 178 | const url = `${api}/playlist/detail` 179 | try { 180 | const { data } = await axios({ 181 | method: 'POST', 182 | url, 183 | params: { 184 | id, 185 | }, 186 | }) 187 | return data 188 | } catch (error) { 189 | console.log(`获取歌单详情失败`) 190 | console.log(error?.response?.data) 191 | return {} 192 | } 193 | } 194 | 195 | /** 196 | * @description: 根据每日歌单推荐刷播放量 197 | */ 198 | const playDailyLists = async (api) => { 199 | const url = `${api}/scrobble` 200 | const { recommend } = await getDailyPlaylist(api) 201 | if (!recommend) return '每日推荐歌单刷取失败' 202 | try { 203 | recommend.forEach(async (item) => { 204 | const { privileges } = await getPlaylistContent(item.id, api) 205 | privileges.forEach(async (song) => { 206 | await axios({ 207 | method: 'POST', 208 | url, 209 | params: { 210 | id: song.id, 211 | sourceid: item.id, 212 | time: 1000, 213 | }, 214 | }) 215 | }) 216 | }) 217 | console.log('每日推荐歌单刷取完成') 218 | return '每日推荐歌单刷取完成' 219 | } catch (error) { 220 | console.log(`每日推荐歌单刷取失败`) 221 | console.log(error?.response?.data) 222 | return '每日推荐歌单刷取失败' 223 | } 224 | } 225 | 226 | /** 227 | * @description: 获取每日推荐歌曲 228 | */ 229 | const getDailySongs = async (api) => { 230 | const url = `${api}/recommend/songs` 231 | try { 232 | const { data } = await axios({ 233 | method: 'POST', 234 | url, 235 | }) 236 | return data.data 237 | } catch (error) { 238 | console.log(`获取每日推荐歌曲失败`) 239 | console.log(error?.response?.data) 240 | return {} 241 | } 242 | } 243 | 244 | /** 245 | * @description: 听歌打卡, 根据每日推荐刷听歌量 246 | */ 247 | const playDailySongs = async (api) => { 248 | const url = `${api}/scrobble` 249 | const { dailySongs } = await getDailySongs(api) 250 | if (!dailySongs) return '每日推荐歌曲刷取失败' 251 | try { 252 | dailySongs.forEach(async (song) => { 253 | await axios({ 254 | method: 'POST', 255 | url, 256 | params: { 257 | id: song.id, 258 | sourceid: song.al.id, 259 | time: 500, 260 | }, 261 | }) 262 | }) 263 | console.log('每日推荐歌曲刷取完成') 264 | return '每日推荐歌曲刷取完成' 265 | } catch (error) { 266 | console.log(`每日推荐歌曲刷取失败,error: ${error?.response?.data}`) 267 | return '每日推荐歌曲刷取失败' 268 | } 269 | } 270 | 271 | export const main = async (event, context, callback) => { 272 | context.callbackWaitsForEmptyEventLoop = false 273 | let res = {} 274 | try { 275 | INFO.api = await getLocalApi(CONFIG_DIR) 276 | INFO.cookies = await getCookies(CONFIG_DIR, INFO) 277 | while (INFO.cookies.length) { 278 | const { phone } = INFO.accounts.shift() 279 | res[phone] = [] 280 | console.log('开始处理' + phone) 281 | res[phone].push(await playDailySongs(INFO.api)) 282 | res[phone].push(await playDailyLists(INFO.api)) 283 | res[phone].push(await checkIn(INFO.api)) 284 | INFO.cookies.shift() 285 | } 286 | } catch (error) { 287 | res[error] = error 288 | } 289 | callback(null, res) 290 | } 291 | main({}, {}, () => {}) 292 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 4 | require("core-js/modules/es.object.define-property.js"); 5 | require("core-js/modules/es.symbol.js"); 6 | require("core-js/modules/es.symbol.description.js"); 7 | require("core-js/modules/es.symbol.iterator.js"); 8 | require("core-js/modules/es.symbol.async-iterator.js"); 9 | require("core-js/modules/es.symbol.to-string-tag.js"); 10 | require("core-js/modules/es.json.to-string-tag.js"); 11 | require("core-js/modules/es.math.to-string-tag.js"); 12 | require("core-js/modules/es.object.create.js"); 13 | require("core-js/modules/es.object.get-prototype-of.js"); 14 | require("core-js/modules/es.function.name.js"); 15 | require("core-js/modules/es.object.set-prototype-of.js"); 16 | require("core-js/modules/es.array.reverse.js"); 17 | Object.defineProperty(exports, "__esModule", { 18 | value: true 19 | }); 20 | exports.main = void 0; 21 | require("core-js/modules/es.array.join.js"); 22 | require("core-js/modules/es.regexp.exec.js"); 23 | require("core-js/modules/es.string.replace.js"); 24 | require("core-js/modules/es.array.iterator.js"); 25 | require("core-js/modules/es.object.to-string.js"); 26 | require("core-js/modules/es.promise.js"); 27 | require("core-js/modules/es.string.iterator.js"); 28 | require("core-js/modules/web.dom-collections.iterator.js"); 29 | require("core-js/modules/es.array.map.js"); 30 | require("core-js/modules/es.array.slice.js"); 31 | require("core-js/modules/es.array.for-each.js"); 32 | require("core-js/modules/web.dom-collections.for-each.js"); 33 | require("core-js/modules/es.date.now.js"); 34 | require("core-js/modules/es.date.to-string.js"); 35 | require("core-js/modules/es.array.includes.js"); 36 | require("core-js/modules/es.string.includes.js"); 37 | var _axios = _interopRequireDefault(require("axios")); 38 | var _path = _interopRequireDefault(require("path")); 39 | var _libphonenumberJs = _interopRequireDefault(require("libphonenumber-js")); 40 | var _fs = require("fs"); 41 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 42 | function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 43 | function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } 44 | function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } 45 | var readFile = _fs.promises.readFile; 46 | var CONFIG_DIR = _path["default"].join(__dirname, 'config'); 47 | var INFO = { 48 | api: undefined, 49 | cookies: [], 50 | accounts: [] 51 | }; 52 | 53 | /** 54 | * @description: 获取api 55 | */ 56 | var getLocalApi = /*#__PURE__*/function () { 57 | var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dir) { 58 | var api, content; 59 | return _regeneratorRuntime().wrap(function _callee$(_context) { 60 | while (1) { 61 | switch (_context.prev = _context.next) { 62 | case 0: 63 | _context.prev = 0; 64 | _context.next = 3; 65 | return readFile("".concat(dir, "/api"), 'utf-8'); 66 | case 3: 67 | content = _context.sent; 68 | api = content.replace(/[\s]/g, ''); 69 | _context.next = 11; 70 | break; 71 | case 7: 72 | _context.prev = 7; 73 | _context.t0 = _context["catch"](0); 74 | console.log('读取本地API配置失败,使用默认的API配置'); 75 | api = 'https://api.littlecontrol.me'; 76 | case 11: 77 | return _context.abrupt("return", api); 78 | case 12: 79 | case "end": 80 | return _context.stop(); 81 | } 82 | } 83 | }, _callee, null, [[0, 7]]); 84 | })); 85 | return function getLocalApi(_x) { 86 | return _ref.apply(this, arguments); 87 | }; 88 | }(); 89 | 90 | /** 91 | * @description: 通过手机号登陆,获取Cookie 92 | */ 93 | var getCookies = /*#__PURE__*/function () { 94 | var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(dir, info) { 95 | var url, accounts, cookies, _error$response; 96 | return _regeneratorRuntime().wrap(function _callee3$(_context3) { 97 | while (1) { 98 | switch (_context3.prev = _context3.next) { 99 | case 0: 100 | if (info.api) { 101 | _context3.next = 4; 102 | break; 103 | } 104 | _context3.next = 3; 105 | return getLocalApi(dir); 106 | case 3: 107 | info.api = _context3.sent; 108 | case 4: 109 | url = "".concat(info.api, "/login/cellphone"); 110 | _context3.prev = 5; 111 | _context3.next = 8; 112 | return getAccountInfo(dir); 113 | case 8: 114 | accounts = _context3.sent; 115 | info.accounts = accounts; 116 | _context3.next = 12; 117 | return Promise.all(accounts.map( /*#__PURE__*/function () { 118 | var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(current) { 119 | var _yield$axios, data; 120 | return _regeneratorRuntime().wrap(function _callee2$(_context2) { 121 | while (1) { 122 | switch (_context2.prev = _context2.next) { 123 | case 0: 124 | _context2.next = 2; 125 | return (0, _axios["default"])({ 126 | method: 'POST', 127 | url: url, 128 | data: { 129 | phone: current.phone, 130 | password: current.password, 131 | countrycode: current.countrycode 132 | } 133 | }); 134 | case 2: 135 | _yield$axios = _context2.sent; 136 | data = _yield$axios.data; 137 | console.log(current.phone.slice(-4) + '登陆成功'); 138 | return _context2.abrupt("return", data === null || data === void 0 ? void 0 : data.cookie); 139 | case 6: 140 | case "end": 141 | return _context2.stop(); 142 | } 143 | } 144 | }, _callee2); 145 | })); 146 | return function (_x4) { 147 | return _ref3.apply(this, arguments); 148 | }; 149 | }())); 150 | case 12: 151 | cookies = _context3.sent; 152 | return _context3.abrupt("return", cookies); 153 | case 16: 154 | _context3.prev = 16; 155 | _context3.t0 = _context3["catch"](5); 156 | console.log('获取Cookie失败'); 157 | console.log(_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.response); 158 | console.log(_context3.t0 === null || _context3.t0 === void 0 ? void 0 : (_error$response = _context3.t0.response) === null || _error$response === void 0 ? void 0 : _error$response.data); 159 | return _context3.abrupt("return", []); 160 | case 22: 161 | case "end": 162 | return _context3.stop(); 163 | } 164 | } 165 | }, _callee3, null, [[5, 16]]); 166 | })); 167 | return function getCookies(_x2, _x3) { 168 | return _ref2.apply(this, arguments); 169 | }; 170 | }(); 171 | 172 | /** 173 | * @description: 从文件读取账户信息 174 | */ 175 | var getAccountInfo = /*#__PURE__*/function () { 176 | var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(dir) { 177 | var res, fileContent, contentArr; 178 | return _regeneratorRuntime().wrap(function _callee4$(_context4) { 179 | while (1) { 180 | switch (_context4.prev = _context4.next) { 181 | case 0: 182 | res = []; 183 | _context4.prev = 1; 184 | _context4.next = 4; 185 | return readFile("".concat(dir, "/account"), 'utf-8'); 186 | case 4: 187 | fileContent = _context4.sent; 188 | contentArr = fileContent.replace(/[\t\r ]/g, '').split('\n'); 189 | contentArr.forEach(function (current, index, array) { 190 | if (index % 2 === 0) { 191 | if (current === '') return; 192 | var parsedNumber = (0, _libphonenumberJs["default"])(current, 'CN'); 193 | res.push({ 194 | phone: parsedNumber === null || parsedNumber === void 0 ? void 0 : parsedNumber.formatNational().replace(/[()\s-]/g, ''), 195 | countrycode: parsedNumber === null || parsedNumber === void 0 ? void 0 : parsedNumber.countryCallingCode, 196 | password: array[index + 1] 197 | }); 198 | } 199 | }); 200 | return _context4.abrupt("return", res); 201 | case 10: 202 | _context4.prev = 10; 203 | _context4.t0 = _context4["catch"](1); 204 | console.log('读取用户账户密码失败'); 205 | return _context4.abrupt("return", []); 206 | case 14: 207 | case "end": 208 | return _context4.stop(); 209 | } 210 | } 211 | }, _callee4, null, [[1, 10]]); 212 | })); 213 | return function getAccountInfo(_x5) { 214 | return _ref4.apply(this, arguments); 215 | }; 216 | }(); 217 | 218 | /** 219 | * @description: 拦截请求,添加cookie等信息 220 | */ 221 | _axios["default"].interceptors.request.use( /*#__PURE__*/function () { 222 | var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(config) { 223 | var _config$params, _config$data; 224 | var method, url; 225 | return _regeneratorRuntime().wrap(function _callee5$(_context5) { 226 | while (1) { 227 | switch (_context5.prev = _context5.next) { 228 | case 0: 229 | config.withCredentials = true; 230 | //防止网易对IP的限制 231 | // config.headers['X-Real-IP'] = '10.0.23.143' 232 | method = config.method, url = config.url; 233 | (_config$params = config.params) !== null && _config$params !== void 0 ? _config$params : config.params = {}; 234 | // config.params.proxy='http://127.0.0.1:7890' 235 | config.params.realIP = '116.25.146.177'; 236 | if ((method === null || method === void 0 ? void 0 : method.toUpperCase()) === 'POST') { 237 | config.params.timestamp = Date.now(); 238 | } 239 | (_config$data = config.data) !== null && _config$data !== void 0 ? _config$data : config.data = {}; 240 | if (!(url !== null && url !== void 0 && url.includes('login'))) { 241 | _context5.next = 8; 242 | break; 243 | } 244 | return _context5.abrupt("return", config); 245 | case 8: 246 | config.data.cookie = INFO.cookies[0]; 247 | // config.headers['Cookie'] = INFO.cookies[0] 248 | return _context5.abrupt("return", config); 249 | case 10: 250 | case "end": 251 | return _context5.stop(); 252 | } 253 | } 254 | }, _callee5); 255 | })); 256 | return function (_x6) { 257 | return _ref5.apply(this, arguments); 258 | }; 259 | }(), /*#__PURE__*/function () { 260 | var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(error) { 261 | return _regeneratorRuntime().wrap(function _callee6$(_context6) { 262 | while (1) { 263 | switch (_context6.prev = _context6.next) { 264 | case 0: 265 | return _context6.abrupt("return", Promise.reject(error)); 266 | case 1: 267 | case "end": 268 | return _context6.stop(); 269 | } 270 | } 271 | }, _callee6); 272 | })); 273 | return function (_x7) { 274 | return _ref6.apply(this, arguments); 275 | }; 276 | }()); 277 | 278 | /** 279 | * @description: 打卡签到 280 | */ 281 | var checkIn = /*#__PURE__*/function () { 282 | var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(api) { 283 | var url, res, _error$response2, _error$response3; 284 | return _regeneratorRuntime().wrap(function _callee7$(_context7) { 285 | while (1) { 286 | switch (_context7.prev = _context7.next) { 287 | case 0: 288 | url = "".concat(api, "/daily_signin"); 289 | res = []; 290 | _context7.prev = 2; 291 | _context7.next = 5; 292 | return (0, _axios["default"])({ 293 | method: 'POST', 294 | url: url 295 | }); 296 | case 5: 297 | console.log('Android端签到完成'); 298 | res.push('Android端签到完成'); 299 | _context7.next = 14; 300 | break; 301 | case 9: 302 | _context7.prev = 9; 303 | _context7.t0 = _context7["catch"](2); 304 | console.log("Android\u7AEF\u7B7E\u5230\u5931\u8D25"); 305 | console.log(_context7.t0 === null || _context7.t0 === void 0 ? void 0 : (_error$response2 = _context7.t0.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data); 306 | res.push('Android端签到失败'); 307 | case 14: 308 | _context7.prev = 14; 309 | _context7.next = 17; 310 | return (0, _axios["default"])({ 311 | method: 'POST', 312 | url: url, 313 | params: { 314 | type: 1 315 | } 316 | }); 317 | case 17: 318 | console.log('Web/PC端签到完成'); 319 | res.push('Web/PC端签到完成'); 320 | _context7.next = 26; 321 | break; 322 | case 21: 323 | _context7.prev = 21; 324 | _context7.t1 = _context7["catch"](14); 325 | console.log("Web/PC\u7AEF\u7B7E\u5230\u5931\u8D25"); 326 | console.log(_context7.t1 === null || _context7.t1 === void 0 ? void 0 : (_error$response3 = _context7.t1.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data); 327 | res.push('Web/PC端签到失败'); 328 | case 26: 329 | console.log('两个平台前端都会有云贝奖励,Android端默认也会进行云贝签到'); 330 | console.log('请登陆网易云查看云贝奖励是否正常'); 331 | return _context7.abrupt("return", res); 332 | case 29: 333 | case "end": 334 | return _context7.stop(); 335 | } 336 | } 337 | }, _callee7, null, [[2, 9], [14, 21]]); 338 | })); 339 | return function checkIn(_x8) { 340 | return _ref7.apply(this, arguments); 341 | }; 342 | }(); 343 | 344 | /** 345 | * @description: 获取每日推荐歌单 346 | */ 347 | var getDailyPlaylist = /*#__PURE__*/function () { 348 | var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(api) { 349 | var url, _yield$axios2, data, _error$response4; 350 | return _regeneratorRuntime().wrap(function _callee8$(_context8) { 351 | while (1) { 352 | switch (_context8.prev = _context8.next) { 353 | case 0: 354 | url = "".concat(api, "/recommend/resource"); 355 | _context8.prev = 1; 356 | _context8.next = 4; 357 | return (0, _axios["default"])({ 358 | method: 'POST', 359 | url: url 360 | }); 361 | case 4: 362 | _yield$axios2 = _context8.sent; 363 | data = _yield$axios2.data; 364 | return _context8.abrupt("return", data); 365 | case 9: 366 | _context8.prev = 9; 367 | _context8.t0 = _context8["catch"](1); 368 | console.log("\u83B7\u53D6\u6BCF\u65E5\u63A8\u8350\u6B4C\u5355\u5931\u8D25"); 369 | console.log(_context8.t0 === null || _context8.t0 === void 0 ? void 0 : (_error$response4 = _context8.t0.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.data); 370 | return _context8.abrupt("return", {}); 371 | case 14: 372 | case "end": 373 | return _context8.stop(); 374 | } 375 | } 376 | }, _callee8, null, [[1, 9]]); 377 | })); 378 | return function getDailyPlaylist(_x9) { 379 | return _ref8.apply(this, arguments); 380 | }; 381 | }(); 382 | 383 | /** 384 | * @description: 获取歌单详情 385 | */ 386 | var getPlaylistContent = /*#__PURE__*/function () { 387 | var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(id, api) { 388 | var url, _yield$axios3, data, _error$response5; 389 | return _regeneratorRuntime().wrap(function _callee9$(_context9) { 390 | while (1) { 391 | switch (_context9.prev = _context9.next) { 392 | case 0: 393 | url = "".concat(api, "/playlist/detail"); 394 | _context9.prev = 1; 395 | _context9.next = 4; 396 | return (0, _axios["default"])({ 397 | method: 'POST', 398 | url: url, 399 | params: { 400 | id: id 401 | } 402 | }); 403 | case 4: 404 | _yield$axios3 = _context9.sent; 405 | data = _yield$axios3.data; 406 | return _context9.abrupt("return", data); 407 | case 9: 408 | _context9.prev = 9; 409 | _context9.t0 = _context9["catch"](1); 410 | console.log("\u83B7\u53D6\u6B4C\u5355\u8BE6\u60C5\u5931\u8D25"); 411 | console.log(_context9.t0 === null || _context9.t0 === void 0 ? void 0 : (_error$response5 = _context9.t0.response) === null || _error$response5 === void 0 ? void 0 : _error$response5.data); 412 | return _context9.abrupt("return", {}); 413 | case 14: 414 | case "end": 415 | return _context9.stop(); 416 | } 417 | } 418 | }, _callee9, null, [[1, 9]]); 419 | })); 420 | return function getPlaylistContent(_x10, _x11) { 421 | return _ref9.apply(this, arguments); 422 | }; 423 | }(); 424 | 425 | /** 426 | * @description: 根据每日歌单推荐刷播放量 427 | */ 428 | var playDailyLists = /*#__PURE__*/function () { 429 | var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(api) { 430 | var url, _yield$getDailyPlayli, recommend, _error$response6; 431 | return _regeneratorRuntime().wrap(function _callee12$(_context12) { 432 | while (1) { 433 | switch (_context12.prev = _context12.next) { 434 | case 0: 435 | url = "".concat(api, "/scrobble"); 436 | _context12.next = 3; 437 | return getDailyPlaylist(api); 438 | case 3: 439 | _yield$getDailyPlayli = _context12.sent; 440 | recommend = _yield$getDailyPlayli.recommend; 441 | if (recommend) { 442 | _context12.next = 7; 443 | break; 444 | } 445 | return _context12.abrupt("return", '每日推荐歌单刷取失败'); 446 | case 7: 447 | _context12.prev = 7; 448 | recommend.forEach( /*#__PURE__*/function () { 449 | var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(item) { 450 | var _yield$getPlaylistCon, privileges; 451 | return _regeneratorRuntime().wrap(function _callee11$(_context11) { 452 | while (1) { 453 | switch (_context11.prev = _context11.next) { 454 | case 0: 455 | _context11.next = 2; 456 | return getPlaylistContent(item.id, api); 457 | case 2: 458 | _yield$getPlaylistCon = _context11.sent; 459 | privileges = _yield$getPlaylistCon.privileges; 460 | privileges.forEach( /*#__PURE__*/function () { 461 | var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(song) { 462 | return _regeneratorRuntime().wrap(function _callee10$(_context10) { 463 | while (1) { 464 | switch (_context10.prev = _context10.next) { 465 | case 0: 466 | _context10.next = 2; 467 | return (0, _axios["default"])({ 468 | method: 'POST', 469 | url: url, 470 | params: { 471 | id: song.id, 472 | sourceid: item.id, 473 | time: 1000 474 | } 475 | }); 476 | case 2: 477 | case "end": 478 | return _context10.stop(); 479 | } 480 | } 481 | }, _callee10); 482 | })); 483 | return function (_x14) { 484 | return _ref12.apply(this, arguments); 485 | }; 486 | }()); 487 | case 5: 488 | case "end": 489 | return _context11.stop(); 490 | } 491 | } 492 | }, _callee11); 493 | })); 494 | return function (_x13) { 495 | return _ref11.apply(this, arguments); 496 | }; 497 | }()); 498 | console.log('每日推荐歌单刷取完成'); 499 | return _context12.abrupt("return", '每日推荐歌单刷取完成'); 500 | case 13: 501 | _context12.prev = 13; 502 | _context12.t0 = _context12["catch"](7); 503 | console.log("\u6BCF\u65E5\u63A8\u8350\u6B4C\u5355\u5237\u53D6\u5931\u8D25"); 504 | console.log(_context12.t0 === null || _context12.t0 === void 0 ? void 0 : (_error$response6 = _context12.t0.response) === null || _error$response6 === void 0 ? void 0 : _error$response6.data); 505 | return _context12.abrupt("return", '每日推荐歌单刷取失败'); 506 | case 18: 507 | case "end": 508 | return _context12.stop(); 509 | } 510 | } 511 | }, _callee12, null, [[7, 13]]); 512 | })); 513 | return function playDailyLists(_x12) { 514 | return _ref10.apply(this, arguments); 515 | }; 516 | }(); 517 | 518 | /** 519 | * @description: 获取每日推荐歌曲 520 | */ 521 | var getDailySongs = /*#__PURE__*/function () { 522 | var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(api) { 523 | var url, _yield$axios4, data, _error$response7; 524 | return _regeneratorRuntime().wrap(function _callee13$(_context13) { 525 | while (1) { 526 | switch (_context13.prev = _context13.next) { 527 | case 0: 528 | url = "".concat(api, "/recommend/songs"); 529 | _context13.prev = 1; 530 | _context13.next = 4; 531 | return (0, _axios["default"])({ 532 | method: 'POST', 533 | url: url 534 | }); 535 | case 4: 536 | _yield$axios4 = _context13.sent; 537 | data = _yield$axios4.data; 538 | return _context13.abrupt("return", data.data); 539 | case 9: 540 | _context13.prev = 9; 541 | _context13.t0 = _context13["catch"](1); 542 | console.log("\u83B7\u53D6\u6BCF\u65E5\u63A8\u8350\u6B4C\u66F2\u5931\u8D25"); 543 | console.log(_context13.t0 === null || _context13.t0 === void 0 ? void 0 : (_error$response7 = _context13.t0.response) === null || _error$response7 === void 0 ? void 0 : _error$response7.data); 544 | return _context13.abrupt("return", {}); 545 | case 14: 546 | case "end": 547 | return _context13.stop(); 548 | } 549 | } 550 | }, _callee13, null, [[1, 9]]); 551 | })); 552 | return function getDailySongs(_x15) { 553 | return _ref13.apply(this, arguments); 554 | }; 555 | }(); 556 | 557 | /** 558 | * @description: 听歌打卡, 根据每日推荐刷听歌量 559 | */ 560 | var playDailySongs = /*#__PURE__*/function () { 561 | var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(api) { 562 | var url, _yield$getDailySongs, dailySongs, _error$response8; 563 | return _regeneratorRuntime().wrap(function _callee15$(_context15) { 564 | while (1) { 565 | switch (_context15.prev = _context15.next) { 566 | case 0: 567 | url = "".concat(api, "/scrobble"); 568 | _context15.next = 3; 569 | return getDailySongs(api); 570 | case 3: 571 | _yield$getDailySongs = _context15.sent; 572 | dailySongs = _yield$getDailySongs.dailySongs; 573 | if (dailySongs) { 574 | _context15.next = 7; 575 | break; 576 | } 577 | return _context15.abrupt("return", '每日推荐歌曲刷取失败'); 578 | case 7: 579 | _context15.prev = 7; 580 | dailySongs.forEach( /*#__PURE__*/function () { 581 | var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(song) { 582 | return _regeneratorRuntime().wrap(function _callee14$(_context14) { 583 | while (1) { 584 | switch (_context14.prev = _context14.next) { 585 | case 0: 586 | _context14.next = 2; 587 | return (0, _axios["default"])({ 588 | method: 'POST', 589 | url: url, 590 | params: { 591 | id: song.id, 592 | sourceid: song.al.id, 593 | time: 500 594 | } 595 | }); 596 | case 2: 597 | case "end": 598 | return _context14.stop(); 599 | } 600 | } 601 | }, _callee14); 602 | })); 603 | return function (_x17) { 604 | return _ref15.apply(this, arguments); 605 | }; 606 | }()); 607 | console.log('每日推荐歌曲刷取完成'); 608 | return _context15.abrupt("return", '每日推荐歌曲刷取完成'); 609 | case 13: 610 | _context15.prev = 13; 611 | _context15.t0 = _context15["catch"](7); 612 | console.log("\u6BCF\u65E5\u63A8\u8350\u6B4C\u66F2\u5237\u53D6\u5931\u8D25,error: ".concat(_context15.t0 === null || _context15.t0 === void 0 ? void 0 : (_error$response8 = _context15.t0.response) === null || _error$response8 === void 0 ? void 0 : _error$response8.data)); 613 | return _context15.abrupt("return", '每日推荐歌曲刷取失败'); 614 | case 17: 615 | case "end": 616 | return _context15.stop(); 617 | } 618 | } 619 | }, _callee15, null, [[7, 13]]); 620 | })); 621 | return function playDailySongs(_x16) { 622 | return _ref14.apply(this, arguments); 623 | }; 624 | }(); 625 | var main = /*#__PURE__*/function () { 626 | var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(event, context, callback) { 627 | var res, _INFO$accounts$shift, phone; 628 | return _regeneratorRuntime().wrap(function _callee16$(_context16) { 629 | while (1) { 630 | switch (_context16.prev = _context16.next) { 631 | case 0: 632 | context.callbackWaitsForEmptyEventLoop = false; 633 | res = {}; 634 | _context16.prev = 2; 635 | _context16.next = 5; 636 | return getLocalApi(CONFIG_DIR); 637 | case 5: 638 | INFO.api = _context16.sent; 639 | _context16.next = 8; 640 | return getCookies(CONFIG_DIR, INFO); 641 | case 8: 642 | INFO.cookies = _context16.sent; 643 | case 9: 644 | if (!INFO.cookies.length) { 645 | _context16.next = 31; 646 | break; 647 | } 648 | _INFO$accounts$shift = INFO.accounts.shift(), phone = _INFO$accounts$shift.phone; 649 | res[phone] = []; 650 | console.log('开始处理' + phone); 651 | _context16.t0 = res[phone]; 652 | _context16.next = 16; 653 | return playDailySongs(INFO.api); 654 | case 16: 655 | _context16.t1 = _context16.sent; 656 | _context16.t0.push.call(_context16.t0, _context16.t1); 657 | _context16.t2 = res[phone]; 658 | _context16.next = 21; 659 | return playDailyLists(INFO.api); 660 | case 21: 661 | _context16.t3 = _context16.sent; 662 | _context16.t2.push.call(_context16.t2, _context16.t3); 663 | _context16.t4 = res[phone]; 664 | _context16.next = 26; 665 | return checkIn(INFO.api); 666 | case 26: 667 | _context16.t5 = _context16.sent; 668 | _context16.t4.push.call(_context16.t4, _context16.t5); 669 | INFO.cookies.shift(); 670 | _context16.next = 9; 671 | break; 672 | case 31: 673 | _context16.next = 36; 674 | break; 675 | case 33: 676 | _context16.prev = 33; 677 | _context16.t6 = _context16["catch"](2); 678 | res[_context16.t6] = _context16.t6; 679 | case 36: 680 | callback(null, res); 681 | case 37: 682 | case "end": 683 | return _context16.stop(); 684 | } 685 | } 686 | }, _callee16, null, [[2, 33]]); 687 | })); 688 | return function main(_x18, _x19, _x20) { 689 | return _ref16.apply(this, arguments); 690 | }; 691 | }(); 692 | exports.main = main; 693 | main({}, {}, function () {}); 694 | --------------------------------------------------------------------------------