* Logs the url(s) found in page, chibi or player. * @param {'page' | 'chibi' | 'player'} type - The type of url (sets log message)
(key, urls, type = URL_TYPES.CHIBI)
| 246 | * @param {'page' | 'chibi' | 'player'} type - The type of url (sets log message) |
| 247 | */ |
| 248 | function logFoundUrls(key, urls, type = URL_TYPES.CHIBI) { |
| 249 | switch (type) { |
| 250 | case 'page': |
| 251 | if (urls.length <= 0) { |
| 252 | console.log(`\n[${key}] No Page found`); |
| 253 | } else if (urls.length === 1) { |
| 254 | console.log(`\n[${key}] Page found:\n`, urls[0]); |
| 255 | } else if (urls.length > 1) { |
| 256 | console.log(`\n[${key}] Pages found:\n`, urls.join(',\n ')); |
| 257 | } |
| 258 | break; |
| 259 | case 'chibi': |
| 260 | if (urls.length <= 0) { |
| 261 | console.log(`\n[${key}] No Chibi found`); |
| 262 | } else if (urls.length === 1) { |
| 263 | console.log(`\n[${key}] Chibi found:\n`, urls[0]); |
| 264 | } else if (urls.length > 1) { |
| 265 | console.log(`\n[${key}] Chibis found:\n`, urls.join(',\n ')); |
| 266 | } |
| 267 | break; |
| 268 | case 'player': |
| 269 | if (urls.length <= 0) { |
| 270 | console.log(`\n[${key}] No Player found`); |
| 271 | } else if (urls.length === 1) { |
| 272 | console.log(`\n[${key}] Player found:\n`, urls[0]); |
| 273 | } else if (urls.length > 1) { |
| 274 | console.log(`\n[${key}] Players found:\n`, urls.join(',\n')); |
| 275 | } |
| 276 | break; |
| 277 | default: |
| 278 | throw new Error('Invalid type provided.'); |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | async function start() { |
| 283 | const args = process.argv.slice(2); |
no outgoing calls
no test coverage detected