File size: 1,027 Bytes
4c0b9f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require("../../../configs")
/**
 * Copyright © 2025 [ balxzzy ]
 *
 * All rights reserved. This source code is the property of [ Shiina Team ].
 * Unauthorized copying, distribution, modification, or use of this file,
 * via any medium, is strictly prohibited without prior written permission.
 *
 * This software is protected under international copyright laws.
 *
 * Contact: [ pa424013@gmail.com ]
 * GitHub: https://github.com/balxz
 */


exports.loadScrapers = (dir) => {
  let scrapers = {}
  for (const folder of fs.readdirSync(dir)) {
    let folderPath = path.join(dir, folder)
    if (!fs.statSync(folderPath).isDirectory()) continue
    scrapers[folder] = {}
    for (const file of fs.readdirSync(folderPath)) {
      if (file.endsWith(".js")) {
        let filePath = path.join(folderPath, file)
        Object.assign(scrapers[folder], require(filePath))
      }
    }
  }
  return scrapers
}

let file = require.resolve(__filename)
fs.watchFile(file, () => {
  fs.unwatchFile(file)
  delete require.cache[file]
})