@JSer/

imag.cf scraper

Nodejs

No description

fork
loading
Files
  • index.js
  • images.txt
  • package-lock.json

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6594981303872178","path":"index.js","file":{"path":"index.js","content":{"asEncoding":{"base64":"Y29uc3QgZXhwcmVzcyA9IHJlcXVpcmUoJ2V4cHJlc3MnKTsKY29uc3QgYXBwID0gZXhwcmVzcygpOwoKY29uc3QgZnMgPSByZXF1aXJlKCdmcycpOwoKbGV0IGltYWdlcyA9IFtdOwoKZnMucmVhZEZpbGUoJ2ltYWdlcy50eHQnLCAndXRmOCcsIChlcnIsIGRhdGEpID0+IHsKICBpbWFnZXMgPSBkYXRhLnNwbGl0KCdcbicpOwp9KTsKCmFwcC5nZXQoJy8nLCAocmVxLCByZXMpID0+IHsKICBsZXQgYm9keSA9ICIiOwogIGZvciAoY29uc3QgdXJsIG9mIGltYWdlcykgewogICAgYm9keSArPSBgPGEgaHJlZj0iJHt1cmx9Ij4ke3VybH08L2E+PGJyPmA7CiAgICBib2R5ICs9IGA8aW1nIHNyYz0iJHt1cmx9Ij48YnI+YDsKICB9CiAgcmVzLmVuZChib2R5KTsKfSk7CgphcHAubGlzdGVuKHByb2Nlc3MuZW52LlBPUlQpOwoKCmNvbnN0IHJlcXVlc3QgPSByZXF1aXJlKCdyZXF1ZXN0JykKCmNvbnN0IGNoYXJzID0gIjAxMjM0NTY3ODlBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWiIKCgpmdW5jdGlvbiB1cGRhdGUoKSB7CiAgbGV0IGJvZHkgPSAiIjsKICBsZXQgaSA9IDA7CiAgY29uc3QgdGVtcCA9IFtdOwogIGNvbnN0IGludGVydmFsID0gc2V0SW50ZXJ2YWwoKCkgPT4gewogICAgaWYgKGkgPiBjaGFycy5sZW5ndGggKiogMykgewogICAgICBjbGVhckludGVydmFsKGludGVydmFsKTsKICAgICAgdGVtcC5zb3J0KCk7CiAgICAgIGltYWdlcyA9IHRlbXA7CiAgICAgIHJldHVybjsKICAgIH0KICAgIGNvbnN0IHVybCA9ICJodHRwczovL3d3dy5pbWFnLmNmLyIgKyBjaGFyc1tNYXRoLmZsb29yKGkgLyBjaGFycy5sZW5ndGggKiogMiAlIGNoYXJzLmxlbmd0aCldICsgY2hhcnNbTWF0aC5mbG9vcihpIC8gY2hhcnMubGVuZ3RoICUgY2hhcnMubGVuZ3RoKV0gKyBjaGFyc1tpICUgY2hhcnMubGVuZ3RoXQogICAgcmVxdWVzdCh7CiAgICAgIG1ldGhvZDogJ2dldCcsCiAgICAgIHVyaTogdXJsLAogICAgICByZXNvbHZlV2l0aEZ1bGxSZXNwb25zZTogdHJ1ZQogICAgfSwgKGVyciwgcmVzLCBib2R5KSA9PiB7CiAgICAgIGlmIChlcnIpIHJldHVybjsKICAgICAgaWYgKHJlcy5zdGF0dXNDb2RlICE9IDQwNCkgdGVtcC5wdXNoKHVybCk7CiAgICB9KQogICAgaSsrCiAgfSwgNSk7Cn0KCnNldEludGVydmFsKHVwZGF0ZSwgMTAwMCAqIDYwICogMzApOw=="},"asBuffer":null},"loaded":true}}
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const express = require('express');
const app = express();

const fs = require('fs');

let images = [];

fs.readFile('images.txt', 'utf8', (err, data) => {
  images = data.split('\n');
});

app.get('/', (req, res) => {
  let body = "";
  for (const url of images) {
    body += `<a href="${url}">${url}</a><br>`;
    body += `<img src="${url}"><br>`;
  }
  res.end(body);
});

app.listen(process.env.PORT);


const request = require('request')

const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"


function update() {
  let body = "";
  let i = 0;
  const temp = [];
  const interval = setInterval(() => {
    if (i > chars.length ** 3) {
      clearInterval(interval);
      temp.sort();
      images = temp;
      return;
    }
    const url = "https://www.imag.cf/" + chars[Math.floor(i / chars.length ** 2 % chars.length)] + chars[Math.floor(i / chars.length % chars.length)] + chars[i % chars.length]
    request({
      method: 'get',
      uri: url,
      resolveWithFullResponse: true
    }, (err, res, body) => {
      if (err) return;
      if (res.statusCode != 404) temp.push(url);
    })
    i++
  }, 5);
}

setInterval(update, 1000 * 60 * 30);
node v10.16.0