improve testing, add aylink, update packages

pull/4/head
aria 3 months ago
parent 007231fb6a
commit 60a9e3279a
Signed by: a
GPG Key ID: E851AE999FFCBC37
  1. 1
      docs/SITES.md
  2. 10
      docs/TESTING.md
  3. 65
      extractors/aylink.js
  4. 24
      package-lock.json
  5. 3
      tests.js

@ -12,6 +12,7 @@ Redirects not directly linking to our site may be NSFW and are not endorsements
|**`123link.pw`**|Puppeteer + Adblocker + Stealth|Yes||`123link.biz`, `123link.co`, `123link.vip`||
|**`adf.ly`**|Axios|No|[http://usheethe.com/T3F5](http://usheethe.com/T3F5)|`usheethe.com`|There is not a complete list of domains under adf.ly's net that I could find, but there is an algorythm for finding them.|
|**`adlinkfly`**|Puppeteer + Stealth|Sometimes, but always required|[https://pdiskshortener.com/6I2CR2](https://pdiskshortener.com/6I2CR2), [https://dz-linkk.com/N2xFP](https://dz-linkk.com/N2xFP)|`adlinkfly.mightyscripts.xyz`, `pdiskshortener.com`, `dzlinkk.com`|Like adf.ly, there is not a list of adlinkfly sites, but there is an algorithm to find them.|
|**`aylink.co`**|Puppeteer + Stealth|Yes|[https://aylink.co/xay664](https://aylink.co/xay664) redirects to `https://mega.nz/folder/hpIAnRLS#fJZX651qRZdf_DU2Y_k0kA`||
|**`bc.vc`**|Puppeteer + Stealth|No|[https://bc.vc/vQesLIh](https://bc.vc/vQesLIh) redirects to `https://universal-bypass.org/`.||
|**`boost.ink`**|Axios|No|[https://boost.ink/c5bba](https://boost.ink/c5bba)|`bst.gg`, `bst.wtf`, `booo.st`||
|**`boostme.link`**|Axios|No|[https://boostme.link/iX9Krf](https://boostme.link/iX9Krf)||

@ -8,10 +8,10 @@ Here are the following ways to test extractors.
Your terminal must be in the root of the BIFM folder to run the following commands.
It is recommended to turn on `debug` in your config before running the tests script.
It is recommended to turn `debug` to `true` in your config before running the tests script.
```
node ./tests.js "[start domain/extractor name/index]" "[end domain/extractor name/index/'-']"
node ./tests.js "[domain/extractor name/index]" "[end domain/extractor name/index/'-']"
```
### Examples
@ -22,6 +22,12 @@ If you want to run the boost.ink example and end it after:
node ./tests.js boost.ink -
```
or
```
node ./tests.js boost -
```
Run all tests available:
```

@ -0,0 +1,65 @@
const pup = require("puppeteer-extra");
const stl = require("puppeteer-extra-plugin-stealth");
const lib = require("../lib");
module.exports = {
hostnames: ["aylink.co"],
requiresCaptcha: true,
get: async function(url) {
let b;
try {
pup.use(stl());
if (lib.config().captcha.active == false) {
throw "Captcha service is required for this link, but this instance doesn't support it."
}
if (lib.config().debug == true) console.log("[aylink] Launching browser...");
b = await pup.launch({headless: true});
let p = await b.newPage();
await p.goto(url);
if (lib.config().debug == true) console.log("[aylink] Solving CAPTCHA...");
await p.evaluate(function() {window.stop()});
let sk = await p.evaluate(function() {return document.querySelector(".g-recaptcha").getAttribute("data-sitekey")});
let c = await lib.solve(sk, "recaptcha", {referer: (await p.url())});
await p.evaluate(`document.querySelector("[name='g-recaptcha-response']").value = "${c}";`);
await p.evaluate(function() {document.querySelector("#recaptcha-form").submit()})
if (lib.config().debug == true) console.log("[aylink] Solved CAPTCHA. Counting down...");
await p.waitForNavigation();
await p.waitForSelector(".complete", {visible: true});
if (lib.config().debug == true) console.log("[aylink] Done. Opening next page...");
await p.click(".complete");
await p.bringToFront();
let a = giveTab(b);
await p.click(".complete");
if (lib.config().debug == true) console.log("[aylink] Done. Waiting for page object...");
a = await a;
if (lib.config().debug == true) console.log("[aylink] Done. Extracting data...");
a = await a.evaluate(function() {
return document.body.innerHTML.split("url = '")[1]?.split("'")[0];
});
return a;
} catch(err) {
if (b !== undefined) await b.close();
throw err;
}
}
}
async function giveTab(b) {
return new Promise(function(resolve, reject) {
b.on("targetcreated", async function(p) {
if ((await p.type()) == "page") {
let a = await p.url();
a = new URL(a);
if (a.hostname == "bildirim.in") {
a = (await (await p).page());
resolve(a);
}
}
})
});
}

24
package-lock.json generated

@ -165,9 +165,9 @@
"integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q=="
},
"node_modules/@types/whatwg-url": {
"version": "8.2.1",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz",
"integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==",
"version": "8.2.2",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz",
"integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==",
"dependencies": {
"@types/node": "*",
"@types/webidl-conversions": "*"
@ -1739,9 +1739,9 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/puppeteer-extra-plugin-stealth": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-stealth/-/puppeteer-extra-plugin-stealth-2.10.0.tgz",
"integrity": "sha512-Bpotsjr9cqjzn7On/hL9xzzpxLFWza0mRCwhzNEGPdORbjkXDGu7dg+6mgVg6EtSI9lOr8M1bUJBFvJhVpFJzA==",
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-stealth/-/puppeteer-extra-plugin-stealth-2.10.1.tgz",
"integrity": "sha512-QbFPuzmP1DvG8DqFuJZmBaf3+iMQZUa/ffZCcdItF+T0ya2wdOgeVKhRLl1bLmw+Zag457UouYN/Thwh6vMmHg==",
"dependencies": {
"debug": "^4.1.1",
"puppeteer-extra-plugin": "^3.2.0",
@ -2480,9 +2480,9 @@
"integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q=="
},
"@types/whatwg-url": {
"version": "8.2.1",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz",
"integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==",
"version": "8.2.2",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz",
"integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==",
"requires": {
"@types/node": "*",
"@types/webidl-conversions": "*"
@ -3668,9 +3668,9 @@
}
},
"puppeteer-extra-plugin-stealth": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-stealth/-/puppeteer-extra-plugin-stealth-2.10.0.tgz",
"integrity": "sha512-Bpotsjr9cqjzn7On/hL9xzzpxLFWza0mRCwhzNEGPdORbjkXDGu7dg+6mgVg6EtSI9lOr8M1bUJBFvJhVpFJzA==",
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-stealth/-/puppeteer-extra-plugin-stealth-2.10.1.tgz",
"integrity": "sha512-QbFPuzmP1DvG8DqFuJZmBaf3+iMQZUa/ffZCcdItF+T0ya2wdOgeVKhRLl1bLmw+Zag457UouYN/Thwh6vMmHg==",
"requires": {
"debug": "^4.1.1",
"puppeteer-extra-plugin": "^3.2.0",

@ -6,6 +6,7 @@ const examples = [
{ link: "http://1link.club/77679" },
{ extractor: "adf.ly", link: "http://usheethe.com/T3F5" },
{ extractor: "adlinkfly", link: "https://pdiskshortener.com/6I2CR2" },
{ link: "https://aylink.co/xay664", expected: "https://mega.nz/folder/hpIAnRLS#fJZX651qRZdf_DU2Y_k0kA" },
{ link: "https://bc.vc/vQesLIh", expected: "https://universal-bypass.org/" },
{ link: "https://boost.ink/c5bba" },
{ link: "https://boostme.link/iX9Krf" },
@ -34,7 +35,7 @@ if (process.argv[2]) {
if (lib.config().debug == true) console.log("[testing] Parsing arguments...");
let intForm = parseInt(process.argv[2]);
if (intForm !== process.argv[2]) intForm = examples.findIndex(e => (e.extractor || new URL(e.link).hostname) == process.argv[2]);
if (intForm !== process.argv[2]) intForm = examples.findIndex(e => (e.extractor || new URL(e.link).hostname || new URL(e.link).hostname).split(".")[0] == process.argv[2]);
if (lib.config().debug == true) console.log(`[testing] Parsed starting interger as: ${intForm}`);

Loading…
Cancel
Save