migrate to playwright / remove tei.ai / fix gplinksextractor / improve lib slightly

main
aria 10 months ago
parent d84f7a5839
commit ac271baafd
Signed by: a
GPG Key ID: E851AE999FFCBC37

@ -86,4 +86,4 @@ FASTFORWARD
ALERT
```
Or you can set a variable called `CONFIG_TEXT` with a stringified version of a config.json file compatible with BIFM.
Or you can set a variable called `CONFIG_TEXT` with a stringified version of a lib.config.json file compatible with BIFM.

@ -31,7 +31,7 @@ module.exports = {
hostnames: [],
requiresCaptcha: false,
get: async function(url, opt) {
if (lib.config().debug == true) console.log("[scraper] Requesting page...");
if (lib.config.debug == true) console.log("[scraper] Requesting page...");
let resp = await got({
method: "GET",
url: url,
@ -41,7 +41,7 @@ module.exports = {
}
});
if (lib.config().debug == true) console.log("[scraper] Got page. Parsing page...");
if (lib.config.debug == true) console.log("[scraper] Got page. Parsing page...");
let $ = cheerio.load(resp.body);
// do stuff with resp.body here
@ -62,10 +62,10 @@ Obviously mess with headers and other details as needed. Then, you can scrape th
Copy and paste this template into your extractor.
```js
const pup = require("puppeteer-extra");
const pw = require("playwright-extra");
//const stl = require("puppeteer-extra-plugin-stealth");
//const adb = require("puppeteer-extra-plugin-adblocker");
//const cap = require("puppeteer-extra-plugin-recaptcha");
//const { PlaywrightBlocker } = require("@cliqz/adblocker-playwright");
//const cap = require("@extra/recaptcha");
const lib = require("../lib");
module.exports = {
@ -74,38 +74,26 @@ module.exports = {
get: async function(url) {
let b;
try {
pup.use(stl());
/*
Delete the portion above and uncomment this if the site
let stlh = stl();
stlh.enabledEvasions.delete("iframe.contentWindow");
pup.use(stlh);
stlh.enabledEvasions.delete("user-agent-override");
pw.firefox.use(stlh);
*/
if (lib.config.debug == true) console.log("[scraper] Launching browser...");
b = await pup.launch({headless: true});
let p = await b.newPage();
/*
pup.use(adb());
TBA
Uncomment this to enable the adblocker.
*/
/*
pup.use(cap({
provider: {
id: lib.config().captcha.service,
token: lib.config().captcha.key
}
}));
Uncomment the portion above if the site given uses CAPTCHAs.
*/
if (lib.config().debug == true) console.log("[scraper] Launching browser...");
b = await pup.launch({headless: true});
let p = await b.newPage();
if (lib.config().debug == true) console.log("[scraper] Launched. Going to page...");
if (lib.config.debug == true) console.log("[scraper] Launched. Going to page...");
p.goto(url);
// put your code here :p
@ -132,13 +120,13 @@ Before pull requesting, add logging to your extractor. This makes it easy to deb
Logging with BIFM is as simple as below:
```js
if (lib.config().debug == true) console.log("[<scraper name>] <infomation of what's happening>");
if (lib.config.debug == true) console.log("[<scraper name>] <infomation of what's happening>");
```
For example, if you're parsing JSON left in the page, do the following:
```js
if (lib.config().debug == true) console.log("[scraper] Parsing JSON data...");
if (lib.config.debug == true) console.log("[scraper] Parsing JSON data...");
```
Also, you should also add you scraper to [these docs](../SITES.md), adding all relevant information to there.

@ -36,7 +36,7 @@ curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.t
If the command in your terminal outputs "Congratulations. This browser is configured to use Tor.", you are set to change the setting in the config, allowing Tor to run on Tor-compatible bypasses.
4. Changing the config.
4. Changing the lib.config.
Open `config.json` in your editor, if you haven't already.

@ -1,6 +1,5 @@
const pup = require("puppeteer-extra");
const adb = require("puppeteer-extra-plugin-adblocker");
const cap = require("puppeteer-extra-plugin-recaptcha");
const pw = require("playwright-extra");
const { PlaywrightBlocker } = require("@cliqz/adblocker-playwright");
const stl = require("puppeteer-extra-plugin-stealth");
const lib = require("../lib");
@ -12,50 +11,41 @@ module.exports = {
get: async function(url, opt) {
let b, p;
try {
pup.use(adb());
let stlh = stl();
stlh.enabledEvasions.delete("iframe.contentWindow");
pup.use(stlh);
stlh.enabledEvasions.delete("user-agent-override");
pw.firefox.use(stlh);
if (lib.config().captcha.active == false) {
if (lib.config.captcha.active == false) {
throw "Captcha service is required for this link, but this instance doesn't support it."
}
pup.use(cap({
provider: {
id: lib.config().captcha.service,
token: lib.config().captcha.key
}
}));
if (lib.config().debug == true) console.log("[1bitspace] Launching browser...");
if (lib.config.debug == true) console.log("[1bitspace] Launching browser...");
let a = (lib.config().defaults?.puppeteer || {headless: true});
let a = (lib.config.defaults?.puppeteer || {headless: true});
b = await pup.launch(lib.removeTor(a));
b = await pup.launch(a);
p = await b.newPage();
if (opt.referer) {
if (lib.config().debug == true) console.log("[1bitspace] Going to referer URL first...");
if (lib.config.debug == true) console.log("[1bitspace] Going to referer URL first...");
await p.goto(opt.referer, {waitUntil: "domcontentloaded"});
}
await p.goto(url);
// first page
if (lib.config().debug == true) console.log("[1bitspace] Launched. Solving CAPTCHA...");
await p.solveRecaptchas();
if (lib.config.debug == true) console.log("[1bitspace] Launched. Solving CAPTCHA...");
await lib.solveThroughPage(p);
await p.waitForTimeout(500);
await p.click(".button-element-verification");
if (lib.config().debug == true) console.log("[1bitspace] Solved CAPTCHA. Counting down...");
if (lib.config.debug == true) console.log("[1bitspace] Solved CAPTCHA. Counting down...");
// second page
await p.waitForSelector(".button-element-redirect:not([disabled])");
if (lib.config().debug == true) console.log("[1bitspace] Done. Loading third page...");
if (lib.config.debug == true) console.log("[1bitspace] Done. Loading third page...");
await p.click(".button-element-redirect:not([disabled])");
await p.waitForNavigation();
// third page
if (lib.config().debug == true) console.log("[1bitspace] Loaded. Parsing URL...");
if (lib.config.debug == true) console.log("[1bitspace] Loaded. Parsing URL...");
let u = await p.url();
u = u.split("api/tokenURL/")[1].split("/")[0];
u = u.split("").reverse().join("");
@ -63,7 +53,7 @@ module.exports = {
u = JSON.parse(u);
u = u[1];
if (lib.config().debug == true) console.log("[1bitspace] Done. Closing browser...");
if (lib.config.debug == true) console.log("[1bitspace] Done. Closing browser...");
await b.close();
return u;

@ -7,18 +7,18 @@ module.exports = {
requiresCaptcha: false,
get: async function(url, opt) {
try {
if (lib.config().debug == true) console.log("[1link] Requesting page...");
if (lib.config.debug == true) console.log("[1link] Requesting page...");
let h = (lib.config().defaults?.got?.headers || lib.config().defaults?.axios?.headers || {});
let h = (lib.config.defaults?.got?.headers || lib.config.defaults?.axios?.headers || {});
if (opt.referer) {
h.Referer = opt.referer;
}
let proxy;
if (lib.config().defaults?.got?.proxy) {
if (lib.config().defaults?.got?.proxy?.type == "socks5") {
if (lib.config.defaults?.got?.proxy) {
if (lib.config.defaults?.got?.proxy?.type == "socks5") {
const agent = require("socks-proxy-agent");
let prox = `socks5://${lib.config().defaults?.got?.proxy?.host}:${lib.config().defaults?.got?.proxy?.port}`;
let prox = `socks5://${config.defaults?.got?.proxy?.host}:${config.defaults?.got?.proxy?.port}`;
try {
if ((new URL(prox).hostname == "localhost" || new URL(prox).hostname == "127.0.0.1") && new URL(proxy).port == "9050") {
proxy = {};
@ -40,7 +40,7 @@ module.exports = {
...proxy
});
if (lib.config().debug == true) console.log("[1link] Got page. Parsing page...");
if (lib.config.debug == true) console.log("[1link] Got page. Parsing page...");
let $ = cheerio.load(resp.body);
if (lib.isUrl($("#download")[0]?.attribs?.href)) return $("#download")[0]?.attribs?.href;

@ -1,7 +1,6 @@
const pup = require("puppeteer-extra");
const pw = require("playwright-extra");
const stl = require("puppeteer-extra-plugin-stealth");
const adb = require("puppeteer-extra-plugin-adblocker");
const cap = require("puppeteer-extra-plugin-recaptcha");
const { PlaywrightBlocker } = require("@cliqz/adblocker-playwright");
const lib = require("../lib");
module.exports = {
@ -11,10 +10,10 @@ module.exports = {
let b;
try {
let stlh = stl();
stlh.enabledEvasions.delete("iframe.contentWindow");
pup.use(stlh);
stlh.enabledEvasions.delete("user-agent-override");
pw.firefox.use(stlh);
if (lib.config().fastforward == true && opt.ignoreFF !== true) {
if (lib.config.fastforward == true && opt.ignoreFF !== true) {
let r = await lib.fastforward.get(url, true);
if (r !== null) {
return {destination: r, fastforward: true};
@ -22,31 +21,30 @@ module.exports = {
}
let hn = new URL(url).hostname;
if (antiAd(hn) == false) pup.use(adb());
else if (lib.config().debug == true) console.log("[adlinkfly] Disabled adblock due to issues with the site.");
let blocker;
blocker = await PlaywrightBlocker.fromPrebuiltFull();
if (lib.config().captcha.active == false) {
if (lib.config.captcha.active == false) {
throw "Captcha service is required for this link, but this instance doesn't support it."
}
pup.use(cap({
provider: {
id: lib.config().captcha.service,
token: lib.config().captcha.key
}
}));
if (lib.config().debug == true) console.log("[adlinkfly] Launching browser...");
let args = (lib.config().defaults?.puppeteer || {headless: true});;
b = await pup.launch(args);
if (lib.config.debug == true) console.log("[adlinkfly] Launching browser...");
let args = (lib.config.defaults?.puppeteer || {headless: true});;
b = await pw.firefox.launch(args);
p = await b.newPage();
if (antiAd(hn) == false) await blocker.enableBlockingInPage(p);
if (opt.referer) {
if (lib.config().debug == true) console.log("[adlinkfly] Going to referer URL first...");
if (lib.config.debug == true) console.log("[adlinkfly] Going to referer URL first...");
await p.goto(opt.referer, {waitUntil: "domcontentloaded"});
}
await p.goto(url, {waitUntil: "networkidle2"});
if (lib.config().debug == true) console.log("[adlinkfly] Done. Starting continuous function...");
try {
await p.goto(url, {waitUntil: "networkidle"});
} catch(e) {
if (!e.message?.toLowerCase()?.includes("timeout")) throw e;
}
if (lib.config.debug == true) console.log("[adlinkfly] Done. Starting continuous function...");
let u = (await cont(p, url));
await b.close();
@ -58,78 +56,50 @@ module.exports = {
}
}
async function cont(p, url, cfc) {
let hn = new URL(url).hostname;
let chn = new URL((await p.url())).hostname;
if (multidomain(hn).length > 1) {
console.log(multidomain(hn));
let n = [];
let dd = multidomain(hn);
for (let c in dd) {
if (dd[c] !== chn) n.push(dd[c]);
}
if (n.length == multidomain(hn).length) {
return (await p.url());
}
} else {
if (hn !== chn) {
return (await p.url());
}
}
if (lib.config().debug == true) console.log("[adlinkfly] Attempting to find CAPTCHA...");
async function cont(p, url) {
if (lib.config.debug == true) console.log("[adlinkfly] Attempting to find CAPTCHA...");
let isCaptcha = await p.evaluate(function () {
if (document.querySelector("#link-view p")?.innerHTML?.includes("Please check the captcha")) return true;
else if (document.querySelector("#content > #click")) return true;
else return false;
});
if (isCaptcha) {
if (lib.config().debug == true) console.log("[adlinkfly] Found CAPTCHA. Solving CAPTCHA...");
await p.solveRecaptchas();
if (lib.config().debug == true) console.log("[adlinkfly] Solved CAPTCHA. Continuing page...");
if (lib.config.debug == true) console.log("[adlinkfly] Found CAPTCHA. Solving CAPTCHA...");
await lib.solveThroughPage(p);
if (lib.config.debug == true) console.log("[adlinkfly] Solved CAPTCHA. Continuing page...");
} else {
if (lib.config().debug == true) console.log("[adlinkfly] No CAPTCHA found. Continuing page...");
}
if (lib.config().debug == true) console.log("[adlinkfly] Attempting to find Cloudflare protection....");
let cf = await lib.cloudflare.check(p);
if (cf == true) {
if (lib.config().debug == true) console.log("[adlinkfly] Found CloudFlare protection, bypassing...");
p = await lib.cloudflare.solve(p);
if (lib.config.debug == true) console.log("[adlinkfly] No CAPTCHA found. Continuing page...");
}
let bd = await p.evaluate(function() {return document.body.innerHTML});
if (bd.split(`document.getElementById('click').style.display = 'none';\n\t\tdocument.getElementById('`)[1]) {
if (lib.config().debug == true) console.log("[adlinkfly] Found hidden CAPTCHA, unhiding and solving...");
let id = bd.split(`document.getElementById('click').style.display = 'none';\n\t\tdocument.getElementById('`)[1].split(`'`)[0];
await p.evaluate(`document.getElementById('${id}').style.display = 'block'`);
await p.waitForTimeout(5000);
await p.solveRecaptchas();
}
if ((await p.$("#countdown"))) {
if (lib.config().debug == true) console.log("[adlinkfly] Retreiving link...");
if (lib.config.debug == true) console.log("[adlinkfly] Retreiving link...");
await p.waitForSelector(".btn-success.btn-lg:not(.disabled):not([disabled]):not([href='javascript: void(0)']):not([href='" + (await p.url()) + "'])");
let r = await p.evaluate(function() {return document.querySelector(".btn-success").href});
return r;
} else {
if ((await p.$("form > div[style='display:none;'] > *[name='_method']")) || (await p.$("[name='hidden'][value='hidden']"))) {
if (lib.config().debug == true) console.log("[adlinkfly] Auto-submitting form...");
if (lib.config.debug == true) console.log("[adlinkfly] Auto-submitting form...");
await p.evaluate(function() {
document.querySelector("form").submit();
});
hn = await new URL(url).hostname;
if (antiAd(hn) == true) {
await p.waitForNavigation({waitUntil: "domcontentloaded"});
await p.waitForLoadState("domcontentloaded");
} else {
await p.waitForNavigation({waitUntil: "networkidle0"});
await p.waitForLoadState("networkidle");
}
return (await cont(p, url));
} else {
return (await p.url());
let cf = await p.$("#cf-challenge-running");
if (cf) {
await p.waitForLoadState("networkidle");
return (await cont(p, url));
} else {
return (await p.url());
}
}
}
}
@ -142,15 +112,4 @@ function antiAd(hn) {
default:
return false;
}
}
function multidomain(hn) {
// use this to prevent too many
switch(hn) {
case "median.uno":
return ["mdn.world", "techydino.net", "median.uno"];
default:
return [hn];
}
}

@ -1,4 +1,4 @@
const pup = require("puppeteer-extra");
const pw = require("playwright-extra");
const stl = require("puppeteer-extra-plugin-stealth");
const lib = require("../lib");
@ -9,19 +9,19 @@ module.exports = {
let b;
try {
let stlh = stl();
stlh.enabledEvasions.delete("iframe.contentWindow");
pup.use(stlh);
stlh.enabledEvasions.delete("user-agent-override");
pw.firefox.use(stlh);
if (lib.config().captcha.active == false) {
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...");
let args = (lib.config().defaults?.puppeteer || {headless: true});
b = await pup.launch(lib.removeTor(args));
if (lib.config.debug == true) console.log("[aylink] Launching browser...");
let args = (lib.config.defaults?.puppeteer || {headless: true});
b = await pw.firefox.launch(args);
p = await b.newPage();
if (opt.referer) {
if (lib.config().debug == true) console.log("[aylink] Going to referer URL first...");
if (lib.config.debug == true) console.log("[aylink] Going to referer URL first...");
await p.goto(opt.referer, {waitUntil: "domcontentloaded"});
}
await p.goto(url);
@ -43,30 +43,30 @@ async function cont(p) {
if (document.querySelector(".sweet-alert")) document.querySelector(".sweet-alert").remove();
});
if (lib.config().debug == true) console.log("[aylink] Launched. Solving CAPTCHA...");
if (lib.config.debug == true) console.log("[aylink] Launched. Solving CAPTCHA...");
await p.evaluate(function() {window.stop()});
if ((await p.$("[name='g-recaptcha-response']"))) {
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...");
if (lib.config.debug == true) console.log("[aylink] Solved CAPTCHA. Counting down...");
await p.waitForNavigation();
await p.waitForLoadState("load");
return (await cont(p));
} else if ((await p.$(".complete"))) {
await p.waitForSelector(".complete", {visible: true});
if (lib.config().debug == true) console.log("[aylink] Done. Fetching next page...");
if (lib.config.debug == true) console.log("[aylink] Done. Fetching next page...");
url = fireWhenFound(p);
await p.click(".complete");
await p.bringToFront();
await p.click(".complete");
url = await url;
if (lib.config().debug == true) console.log("[aylink] Got next page, requesting...");
if (lib.config.debug == true) console.log("[aylink] Got next page, requesting...");
await p.goto(url, {waitUntil: "domcontentloaded"});
if (lib.config().debug == true) console.log("[aylink] Done. Parsing next page...");
if (lib.config.debug == true) console.log("[aylink] Done. Parsing next page...");
let a = await p.content();
a = a.split(`</script>\n<script type="text/javascript">`)[1];
a = a.split(`let`)[1];

@ -1,4 +1,4 @@
const pup = require("puppeteer-extra");
const pw = require("playwright-extra");
const stl = require("puppeteer-extra-plugin-stealth");
const lib = require("../lib");
@ -14,27 +14,27 @@ module.exports = {
try {
// setup plugins
let stlh = stl();
stlh.enabledEvasions.delete("iframe.contentWindow");
pup.use(stlh);
stlh.enabledEvasions.delete("user-agent-override");
pw.firefox.use(stlh);
if (lib.config().debug == true) console.log("[bcvc] Launching browser...");
if (lib.config.debug == true) console.log("[bcvc] Launching browser...");
let args = (lib.config().defaults?.puppeteer || {headless: true});
b = await pup.launch(lib.removeTor(args));
let args = (lib.config.defaults?.puppeteer || {headless: true});
b = await pw.firefox.launch(args);
p = await b.newPage();
if (opt.referer) {
if (lib.config().debug == true) console.log("[adflylink] Going to referer URL first...");
if (lib.config.debug == true) console.log("[adflylink] Going to referer URL first...");
await p.goto(opt.referer, {waitUntil: "domcontentloaded"});
}
await p.goto(url);
if (lib.config().debug == true) console.log("[bcvc] Launched. Counting down...");
if (lib.config.debug == true) console.log("[bcvc] Launched. Counting down...");
await p.waitForSelector("#getLink", {visible: true});
await p.click("#getLink");
await p.waitForNavigation();
let u = await p.url();
if (lib.config().debug == true) console.log("[bcvc] Done. Decoding URL...");
if (lib.config.debug == true) console.log("[bcvc] Done. Decoding URL...");
u = new URL(u);
u = u.searchParams.get("cr");
u = Buffer.from(u, "base64").toString("ascii");

@ -7,14 +7,14 @@ module.exports = {
requiresCaptcha: false,
get: async function(url, opt) {
try {
let h = (lib.config().defaults?.got?.headers || lib.config().defaults?.axios?.headers || {});
let h = (lib.config.defaults?.got?.headers || lib.config.defaults?.axios?.headers || {});
if (opt.referer) {
h.Referer = opt.referer;
}
let proxy;
if (lib.config().defaults?.got?.proxy) {
if (lib.config().defaults?.got?.proxy?.type == "socks5") {
if (lib.config.defaults?.got?.proxy) {
if (lib.config.defaults?.got?.proxy?.type == "socks5") {
const agent = require("socks-proxy-agent");
try {
if ((new URL(prox).hostname == "localhost" || new URL(prox).hostname == "127.0.0.1") && new URL(proxy).port == "9050") {
@ -30,7 +30,7 @@ module.exports = {
}
}
if (lib.config().debug == true) console.log("[boost] Requesting page...");
if (lib.config.debug == true) console.log("[boost] Requesting page...");
let resp = await got({
method: "GET",
url: url,
@ -46,19 +46,19 @@ module.exports = {
let attr;
let scr;
if (lib.config().debug == true) console.log("[boost] Got page. Scanning scripts...");
if (lib.config.debug == true) console.log("[boost] Got page. Scanning scripts...");
for (let a in $("script")) {
if (typeof $("script")[a] == "object") {
if ($("script")[a].attribs && $("script")[a].attribs.src && $("script")[a].attribs.src.includes("unlock")) {
scr = $("script")[a].attribs;
if (lib.config().debug == true) console.log("[boost] Found unlock.js script. Requesting...");
if (lib.config.debug == true) console.log("[boost] Found unlock.js script. Requesting...");
let b = (await got(
{
url: `https://boost.ink${scr["src"]}`,
...proxy
}
)).body;
if (lib.config().debug == true) console.log("[boost] Got script. Searching for attribute needed to decode...");
if (lib.config.debug == true) console.log("[boost] Got script. Searching for attribute needed to decode...");
attr = b.split(`dest=`)[1].split(`currentScript.getAttribute("`)[1].split(`"`)[0];
}
}
@ -66,7 +66,7 @@ module.exports = {
if (attr == undefined) throw "Boost.ink has updated their unlock script. Please update this script to accomodate for this.";
if (lib.config().debug == true) console.log("[boost] Done. Decoding original page...");
if (lib.config.debug == true) console.log("[boost] Done. Decoding original page...");
return Buffer.from(scr[attr], "base64").toString("ascii");
} catch(err) {
throw err;

@ -1,5 +1,6 @@
const got = require("got");
const cheerio = require("cheerio");
const config = require("../config.json")
const lib = require("../lib");
module.exports = {
@ -7,17 +8,17 @@ module.exports = {
requiresCaptcha: false,
get: async function(url, opt) {
try {
if (lib.config().debug == true) console.log("[boostme] Requesting page...");
let h = (lib.config().defaults?.got?.headers || lib.config().defaults?.axios?.headers || {});
if (lib.config.debug == true) console.log("[boostme] Requesting page...");
let h = (lib.config.defaults?.got?.headers || lib.config.defaults?.axios?.headers || {});
if (opt.referer) {
h.Referer = opt.referer;
}
let proxy;
if (lib.config().defaults?.got?.proxy) {
if (lib.config().defaults?.got?.proxy?.type == "socks5") {
if (lib.config.defaults?.got?.proxy) {
if (lib.config.defaults?.got?.proxy?.type == "socks5") {
const agent = require("socks-proxy-agent");
let prox = `socks5://${lib.config().defaults?.got?.proxy?.host}:${lib.config().defaults?.got?.proxy?.port}`;
let prox = `socks5://${config.defaults?.got?.proxy?.host}:${config.defaults?.got?.proxy?.port}`;
if ((new URL(prox).hostname == "localhost" || new URL(prox).hostname == "127.0.0.1") && new URL(prox).port == "9050") {
proxy = {};
} else {
@ -37,7 +38,7 @@ module.exports = {
});
let $ = cheerio.load(resp.body);
if (lib.config().debug == true) console.log("[boostme] Got page. Decoding page...");
if (lib.config.debug == true) console.log("[boostme] Got page. Decoding page...");
if (!$(".main #home").attr("data-url")) {
console.log(resp.body)
throw "Boostme.link bypass has changed or we have been rate limited. If you are the owner of this instance, please dump the terminal contents into an issue on the repo.";

@ -4,20 +4,20 @@ const lib = require("../lib");
module.exports = {
hostnames: [],
requireCaptcha: false,
requiresCaptcha: false,
get: async function(url, opt) {
if (lib.config().debug == true) console.log("[carrd] Requesting page...");
if (lib.config.debug == true) console.log("[carrd] Requesting page...");
let h = (lib.config().defaults?.got?.headers || lib.config().defaults?.axios?.headers || {});
let h = (lib.config.defaults?.got?.headers || lib.config.defaults?.axios?.headers || {});
if (opt.referer) {
h.Referer = opt.referer;
}
let proxy;
if (lib.config().defaults?.got?.proxy) {
if (lib.config().defaults?.got?.proxy?.type == "socks5") {
if (lib.config.defaults?.got?.proxy) {
if (lib.config.defaults?.got?.proxy?.type == "socks5") {
const agent = require("socks-proxy-agent");
let prox = `socks5://${lib.config().defaults?.got?.proxy?.host}:${lib.config().defaults?.got?.proxy?.port}`;
let prox = `socks5://${config.defaults?.got?.proxy?.host}:${config.defaults?.got?.proxy?.port}`;
proxy = {httpsAgent: (new agent.SocksProxyAgent(prox))};
} else {
proxy = {};
@ -32,11 +32,11 @@ module.exports = {
throwHttpErrors: false
});
if (lib.config().debug == true) console.log("[carrd] Got page, parsing...");
if (lib.config.debug == true) console.log("[carrd] Got page, parsing...");
let $ = cheerio.load(resp.body);
let links = [];
if (lib.config().debug == true) console.log("[carrd] Parsed. Filtering out unviewable links...");
if (lib.config.debug == true) console.log("[carrd] Parsed. Filtering out unviewable links...");
await ($("a").each(function(a) {
let h = $("a")[a].attribs?.href;
if (h !== null) {

@ -8,11 +8,11 @@ module.exports = {
requiresCaptcha: false,
get: async function (url, opt) {
try {
if (lib.config().captcha.active == false) {
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("[cpmlink] Requesting page...");
if (lib.config.debug == true) console.log("[cpmlink] Requesting page...");
let header = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
@ -25,8 +25,8 @@ module.exports = {
if (opt.referer) header.Referer = opt.referer;
let proxy;
if (lib.config().defaults?.got?.proxy) {
if (lib.config().defaults?.got?.proxy?.type == "socks5") {
if (lib.config.defaults?.got?.proxy) {
if (lib.config.defaults?.got?.proxy?.type == "socks5") {
const agent = require("socks-proxy-agent");
try {
if ((new URL(prox).hostname == "localhost" || new URL(prox).hostname == "127.0.0.1") && new URL(proxy).port == "9050") {
@ -49,7 +49,7 @@ module.exports = {
...proxy
});
if (lib.config().debug == true) console.log("[cpmlink] Got page. Parsing page...");
if (lib.config.debug == true) console.log("[cpmlink] Got page. Parsing page...");
let $ = cheerio.load(resp.body);
let k = $("#skip [name=key]").val();
let t = $("#skip [name=time]").val();
@ -59,15 +59,15 @@ module.exports = {
let s = $("#captcha").attr("data-sitekey");
let c = lib.cookieString(scp(resp.headers["set-cookie"]));
if (lib.config().debug == true) console.log("[cpmlink] Parsed. Solving CAPTCHA...");
if (lib.config.debug == true) console.log("[cpmlink] Parsed. Solving CAPTCHA...");
let cap = await lib.solve(s, "recaptcha", {
referer: url
});
if (lib.config().debug == true) console.log("[cpmlink] Solved CAPTCHA.");
if (lib.config.debug == true) console.log("[cpmlink] Solved CAPTCHA.");
let body = `key=${k}&time=${t}&ref=${r}&s_width=${w}&s_height=${h}&g-recaptcha-response=${cap}`;
if (lib.config().debug == true) console.log("[cpmlink] Requesting solve page...");
if (lib.config.debug == true) console.log("[cpmlink] Requesting solve page...");
resp = await got({
method: "POST",
body: body,
@ -92,7 +92,7 @@ module.exports = {
},
...proxy
});
if (lib.config().debug == true) console.log("[cpmlink] Parsing solve page...");
if (lib.config.debug == true) console.log("[cpmlink] Parsing solve page...");
$ = cheerio.load(resp.body);
return $("#continue a").attr("href");
} catch(err) {

@ -7,7 +7,7 @@ module.exports = {
requiresCaptcha: false,
get: async function (url, opt) {
try {
if (lib.config().debug == true) console.log("[cshort] Requesting page...");
if (lib.config.debug == true) console.log("[cshort] Requesting page...");
let header = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0",
@ -21,8 +21,8 @@ module.exports = {
if (opt.referer) header.Referer = opt.referer;
let proxy;
if (lib.config().defaults?.got?.proxy) {
if (lib.config().defaults?.got?.proxy?.type == "socks5") {
if (lib.config.defaults?.got?.proxy) {
if (lib.config.defaults?.got?.proxy?.type == "socks5") {
const agent = require("socks-proxy-agent");
try {
if ((new URL(prox).hostname == "localhost" || new URL(prox).hostname == "127.0.0.1") && new URL(proxy).port == "9050") {
@ -46,22 +46,22 @@ module.exports = {
...proxy
});
if (lib.config().debug == true) console.log("[cshort] Getting next page URL (1/2)...");
if (lib.config.debug == true) console.log("[cshort] Getting next page URL (1/2)...");
let r = resp.body.split(`function redirect() {`)[1].split(`}`)[0].split(`\n`);
let h;
let c = `${lib.cookieString(scp(resp.headers["set-cookie"]))}; aid=${encodeURIComponent(JSON.stringify([new URL(url).pathname.substring(1)]))}`;
if (lib.config().debug == true) console.log("[cshort] Getting next page URL (2/2)...");
if (lib.config.debug == true) console.log("[cshort] Getting next page URL (2/2)...");
for (let a in r) {
if (!r[a].startsWith(" //") && r[a] !== "") h = r[a].split(`?u=`)[1].split(`',`)[0];
}
if (h == undefined) throw "No redirects found.";
if (lib.config().debug == true) console.log("[cshort] Counting down...");
if (lib.config.debug == true) console.log("[cshort] Counting down...");
await new Promise(resolve => setTimeout(resolve, 10000)); // can't bypass the wait, unfortunately
if (lib.config().debug == true) console.log("[cshort] Requesting next page URL...");
if (lib.config.debug == true) console.log("[cshort] Requesting next page URL...");
resp = await got({
method: "GET",
throwHttpErrors: false,

@ -1,7 +1,6 @@
const pup = require("puppeteer-extra");
const adb = require("puppeteer-extra-plugin-adblocker");
const pw = require("playwright-extra");
const { PlaywrightBlocker } = require("@cliqz/adblocker-playwright");
const stl = require("puppeteer-extra-plugin-stealth");
const cap = require("puppeteer-extra-plugin-recaptcha");
const lib = require("../lib");
module.exports = {
@ -9,43 +8,38 @@ module.exports = {
get: async function(url, opt) {
let b;
try {
pup.use(adb());
let blocker = await PlaywrightBlocker.fromPrebuiltFull();
let stlh = stl();
stlh.enabledEvasions.delete("iframe.contentWindow");
pup.use(stlh);
stlh.enabledEvasions.delete("user-agent-override");
pw.firefox.use(stlh);
if (lib.config().captcha.active == false) {
if (lib.config.captcha.active == false) {
throw "Captcha service is required for this link, but this instance doesn't support it."
}
pup.use(cap({
provider: {
id: lib.config().captcha.service,
token: lib.config().captcha.key
}
}));
if (lib.config().debug == true) console.log("[cutwin] Launching browser...");
let args = (lib.config().defaults?.puppeteer || {headless: true});
b = await pup.launch(lib.removeTor(args));
if (lib.config.debug == true) console.log("[cutwin] Launching browser...");
let args = (lib.config.defaults?.puppeteer || {headless: true});
b = await pw.firefox.launch(args);
p = await b.newPage();
blocker.enableBlockingInPage(p);
if (opt.referer) {
if (lib.config().debug == true) console.log("[cutwin] Going to referer URL first...");
if (lib.config.debug == true) console.log("[cutwin] Going to referer URL first...");
await p.goto(opt.referer, {waitUntil: "domcontentloaded"});
}
await p.goto(url);
if (lib.config().debug == true) console.log("[cutwin] Solving CAPTCHAs...");
await p.solveRecaptchas();
if (lib.config().debug == true) console.log("[cutwin] Solved CAPTCHA. Auto-submitting form...");
if (lib.config.debug == true) console.log("[cutwin] Solving CAPTCHAs...");
await lib.solveThroughPage(p);
if (lib.config.debug == true) console.log("[cutwin] Solved CAPTCHA. Auto-submitting form...");
await p.evaluate(function() {
document.querySelector("form[method='post']").submit();
});
if (lib.config().debug == true) console.log("[cutwin] Done. Waiting for next page data...");
await p.waitForNavigation();
if (lib.config.debug == true) console.log("[cutwin] Done. Waiting for next page data...");
await p.waitForSelector(".get-link");
if (lib.config().debug == true) console.log("[cutwin] Done. Getting link...");
if (lib.config.debug == true) console.log("[cutwin] Done. Getting link...");
let u = await p.evaluate(function() {
return document.body.innerHTML.split(`$('.get-link').html('<a href="`)[1].split(`">`)[0];
});

@ -8,15 +8,15 @@ module.exports = {
requiresCaptcha: false,
get: async function(url, opt) {
try {
if (lib.config().debug == true) console.log("[dlp] Requesting page...");
let header = (lib.config().defaults?.got?.headers || lib.config().defaults?.axios?.headers || {});
if (lib.config.debug == true) console.log("[dlp] Requesting page...");
let header = (lib.config.defaults?.got?.headers || lib.config.defaults?.axios?.headers || {});
if (opt.referer) header.Referer = opt.referer;
let proxy;
if (lib.config().defaults?.got?.proxy) {
if (lib.config().defaults?.got?.proxy?.type == "socks5") {
if (lib.config.defaults?.got?.proxy) {
if (lib.config.defaults?.got?.proxy?.type == "socks5") {
const agent = require("socks-proxy-agent");
let prox = `socks5://${lib.config().defaults?.got?.proxy?.host}:${lib.config().defaults?.got?.proxy?.port}`;
let prox = `socks5://${config.defaults?.got?.proxy?.host}:${config.defaults?.got?.proxy?.port}`;
proxy = {httpsAgent: (new agent.SocksProxyAgent(prox))};
} else {
proxy = {};
@ -30,19 +30,19 @@ module.exports = {
...proxy
});
if (lib.config().debug == true) console.log("[dlp] Got page. Parsing page...");
if (lib.config.debug == true) console.log("[dlp] Got page. Parsing page...");
let $ = cheerio.load(resp.body);
let pw = $("#wrapper > #content > p").text().includes("Password");
let b;
if (lib.config().debug == true) console.log("[dlp] Parsed. Forming body data...");
if (lib.config.debug == true) console.log("[dlp] Parsed. Forming body data...");
if (pw == true) {
// passworded
if (!opt.password) throw "Incorrect password.";
b = `Pass1=${encodeURIComponent(opt.password)}&Submit0=Submit`;
} else {
if (lib.config().captcha.active == false) {
if (lib.config.captcha.active == false) {
throw "Normally this bypass wouldn't require a CAPTCHA, but it does in it's current state.";
}
let c = lib.cookieString(scp(resp.headers["set-cookie"]));
@ -53,7 +53,7 @@ module.exports = {
b = `security_code=${cap}&submit1=Submit`;
}
if (lib.config().debug == true) console.log("[dlp] Sending body data...");
if (lib.config.debug == true) console.log("[dlp] Sending body data...");
resp = await got({
method: "POST",
url: url,
@ -61,7 +61,7 @@ module.exports = {
headers: header
});
if (lib.config().debug == true) console.log("[dlp] Sent body data. Parsing response...");
if (lib.config.debug == true) console.log("[dlp] Sent body data. Parsing response...");
$ = cheerio.load(resp.body);
console.log(resp.body)
let links = [];
@ -92,7 +92,7 @@ module.exports = {
async function fetchCaptcha(url, ref, h) {
url = `${new URL(ref).protocol}//${new URL(ref).hostname}/${url}`;
if (lib.config().debug == true) console.log("[dlp] Fetching CAPTCHA image...", url);
if (lib.config.debug == true) console.log("[dlp] Fetching CAPTCHA image...", url);
h["Accept"] = "image/avif,image/webp,*/*";
h["Accept-Encoding"] = "gzip, deflate";
@ -109,7 +109,7 @@ async function fetchCaptcha(url, ref, h) {
url: url
});
if (lib.config().debug == true) console.log(`[dlp] Got CAPTCHA, content type `, resp.headers["content-type"]);
if (lib.config.debug == true) console.log(`[dlp] Got CAPTCHA, content type `, resp.headers["content-type"]);
let img = Buffer.from(resp.rawBody).toString("base64")
return `data:${resp.headers["content-type"]};base64,${img}`;

@ -1,4 +1,4 @@
const pup = require("puppeteer-extra");
const pw = require("playwright-extra");
const lib = require("../lib");
module.exports = {
@ -7,20 +7,20 @@ module.exports = {
get: async function (url, opt) {
let b;
try {
if (lib.config().debug == true) console.log("[droplink] Launching browser...");
let args = (lib.config().defaults?.puppeteer || {headless: true});
b = await pup.launch(args);
if (lib.config.debug == true) console.log("[droplink] Launching browser...");
let args = (lib.config.defaults?.puppeteer || {headless: true});
b = await pw.firefox.launch(args);
let p = await b.newPage();
if (lib.config().debug == true) console.log("[droplink] Launched. Faking some steps...");
if (lib.config.debug == true) console.log("[droplink] Launched. Faking some steps...");
await p.goto("https://yoshare.net", {waitUntil: "domcontentloaded"});
await p.evaluate(`window.location = "${url}"`);
if (lib.config().debug == true) console.log("[droplink] Done. Waiting for countdown page...");
if (lib.config.debug == true) console.log("[droplink] Done. Waiting for countdown page...");
await p.waitForLoadState("load");
await p.waitForNavigation();
if (lib.config().debug == true) console.log("[droplink] Done. Counting down...");
if (lib.config.debug == true) console.log("[droplink] Done. Counting down...");
await p.waitForSelector(".btn.btn-success.btn-lg:not([disabled]):not([href='javascript: void(0)'])");
if (lib.config().debug == true) console.log("[droplink] Done. Extracting link...");
if (lib.config.debug == true) console.log("[droplink] Done. Extracting link...");
let a = await p.evaluate(function() {return document.querySelector(".btn-success.btn-lg").href});
await b.close();
return a;

@ -1,82 +1,39 @@
const pup = require("puppeteer-extra");
const adb = require("puppeteer-extra-plugin-adblocker");
const pw = require("playwright-extra");
const { PlaywrightBlocker } = require("@cliqz/adblocker-playwright");
const stl = require("puppeteer-extra-plugin-stealth");
const lib = require("../lib")
module.exports = {
hostnames: ["exe.io", "exey.io", "exe.app", "fc-lc.com", "fc.lc"],
hostnames: ["exe.io", "exey.io", "exe.app", "eie.io", "fc-lc.com", "fc.lc"],
requiresCaptcha: true,
get: async function(url, opt) {
let b;
try {
pup.use(adb());
pup.use(stl());
let blocker = await PlaywrightBlocker.fromPrebuiltFull();
let stlh = stl();
stlh.enabledEvasions.delete("user-agent-override");
pw.firefox.use(stlh);
if (lib.config().captcha.active == false) {
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("[exeio] Launching browser...");
let args = (lib.config().defaults?.puppeteer || {headless: true});
b = await pup.launch(args);
if (lib.config.debug == true) console.log("[exeio] Launching browser...");
let args = (lib.config.defaults?.puppeteer || {headless: true});
b = await pw.firefox.launch(args);
p = await b.newPage();
await blocker.enableBlockingInPage(p);
if (opt.referer) {
if (lib.config().debug == true) console.log("[exeio] Going to referer URL first...");
if (lib.config.debug == true) console.log("[exeio] Going to referer URL first...");
await p.goto(opt.referer, {waitUntil: "domcontentloaded"});
}
await p.goto(url, {waitUntil: "networkidle0"});
await p.goto(url, {waitUntil: "networkidle"});
if (!(await p.url()).includes("exey.io")) {
if (lib.config().debug == true) console.log("[exeio] Launched. Skipping first page...");
try {
if ((await p.$(".btn.btn-primary"))) {
await p.click(".btn.btn-primary");
try {
await p.waitForNavigation({timeout: 10000});
} catch(err) {
if (err.message.includes("Navigation timeout of")) {
if (lib.config().debug == true) console.log("[exeio] First page has CAPTCHA, attempting to solve...");
let type = await p.evaluate(function() {
if (document.querySelector("iframe[title='recaptcha challenge expires in two minutes']")) return "recaptcha";
else if (document.querySelector(".h-captcha")) return "hcaptcha";
else return null;
});
if (type == null) throw "Could not find CAPTCHA type.";
if (lib.config().debug == true) console.log("[exeio] Got CAPTCHA type:", type);
let sk = await p.evaluate(function() {
return (
document.querySelector("iframe[title='recaptcha challenge expires in two minutes']")?.src.split("k=")[1].split("&")[0] ||
document.querySelector(".h-captcha")?.getAttribute("data-sitekey")
);
});
if (lib.config().debug == true) console.log("[exeio] Got sitekey:", sk);
if (lib.config().debug == true) console.log("[exeio] Retrieved. Solving CAPTCHA...");
let c = await lib.solve(sk, type, {referer: (await p.url())});
if (lib.config().debug == true) console.log("[exeio] Solved CAPTCHA. Enterring solution and submitting form...");
await p.evaluate(`document.querySelector("[name='g-recaptcha-response']").value = "${c}";`);
if (type == "hcaptcha") await p.evaluate(`document.querySelector("[name='h-captcha-response']").value = "${c}";`);
await p.evaluate(function() {
document.querySelector("form").submit();
});
await p.waitForNavigation();
} else {
if (err.message !== "Execution context was destroyed, most likely because of a navigation.") throw err;
}
}
} else await p.waitForNavigation();
} catch(err) {
if (err.message !== "Execution context was destroyed, most likely because of a navigation.") throw err;
}
}
await p.evaluate(function() {
document.forms[0].submit();
});
await p.waitForLoadState("load");
if (lib.config().debug == true) console.log("[exeio] Starting continous function...");
p = await cont(p, url, b);
await b.close();
@ -90,45 +47,20 @@ module.exports = {
async function cont(p, url, b) {
try {
if (lib.config().debug == true) console.log("[exeio] Scanning page information...");
if (lib.config.debug == true) console.log("[exeio] Scanning page information...");
if ((await p.$(".box-main > #before-captcha"))) {
if (lib.config().debug == true) console.log("[exeio] Skipping non-CAPTCHA page...");
if (lib.config.debug == true) console.log("[exeio] Skipping non-CAPTCHA page...");
await p.evaluate(function() {
document.querySelector("form").submit();
});
await p.waitForNavigation();
await p.waitForLoadState("load");
return (await cont(p, url, b));
} else if ((await p.$(".btn-captcha"))) {
if (lib.config().debug == true) console.log("[exeio] Retrieving sitekey...");
let type = await p.evaluate(function() {
if (document.querySelector("iframe[title='recaptcha challenge expires in two minutes']")) return "recaptcha";
else if (document.querySelector(".h-captcha")) return "hcaptcha";
else return null;
});
if (type == null) throw "Could not find CAPTCHA type.";
if (lib.config().debug == true) console.log("[exeio] Got CAPTCHA type:", type);
let sk = await p.evaluate(function() {
return (
document.querySelector("iframe[title='recaptcha challenge expires in two minutes']")?.src.split("k=")[1].split("&")[0] ||
document.querySelector(".h-captcha")?.getAttribute("data-sitekey")
);
});
if (lib.config().debug == true) console.log("[exeio] Got sitekey:", sk);
if (lib.config().debug == true) console.log("[exeio] Retrieved. Solving CAPTCHA...");
let c = await lib.solve(sk, type, {referer: (await p.url())});
if (lib.config().debug == true) console.log("[exeio] Solved CAPTCHA. Enterring solution and submitting form...");
await p.evaluate(`document.querySelector("[name='g-recaptcha-response']").value = "${c}";`);
if (type == "hcaptcha") await p.evaluate(`document.querySelector("[name='h-captcha-response']").value = "${c}";`);
await lib.solveThroughPage(p);
p.on("dialog", function(d) {
if (lib.config().debug == true) console.log("[exeio] Recieved a dialog, auto-accepting.");
if (lib.config.debug == true) console.log("[exeio] Recieved a dialog, auto-accepting.");
d.accept();
})
@ -136,18 +68,18 @@ async function cont(p, url, b) {
document.querySelector("form").submit();
});
if (lib.config().debug == true) console.log("[exeio] Submitted. Waiting...");
await p.waitForNavigation();
if (lib.config.debug == true) console.log("[exeio] Submitted. Waiting...");
await p.waitForLoadState("load");
return (await cont(p, url, b));
} else if ((await p.$(".procced > .btn.get-link.text-white"))) {
if (lib.config().debug == true) console.log("[exeio] Counting down...");
if (lib.config.debug == true) console.log("[exeio] Counting down...");
await p.waitForSelector(".procced > .btn.get-link.text-white:not(.disabled)");
let r = await p.evaluate(function() {
return document.querySelector(".procced > .btn.get-link.text-white").href
});
return r;
} else if ((await p.$("#content > div[style]"))) {
if (lib.config().debug == true) console.log("[exeio] Counting down...");
if (lib.config.debug == true) console.log("[exeio] Counting down...");
await p.waitForSelector("#surl:not(.disabled)");
let r = await p.evaluate(function() {
return document.querySelector("#surl").href

@ -1,5 +1,5 @@
const pup = require("puppeteer-extra");
const adb = require("puppeteer-extra-plugin-adblocker");
const pw = require("playwright-extra");
const { PlaywrightBlocker } = require("@cliqz/adblocker-playwright");
const stl = require("puppeteer-extra-plugin-stealth");
const lib = require("../lib");
@ -9,22 +9,21 @@ module.exports = {
get: async function(url, opt) {
let b;
try {
if (lib.config().debug == true) console.log("[ez4] Launching browser...");
if (lib.config.debug == true) console.log("[ez4] Launching browser...");
pup.use(stl());
pup.use(adb());
pw.firefox.use(stl());
let args = (lib.config().defaults?.puppeteer || {headless: true});
let args = (lib.config.defaults?.puppeteer || {headless: true});
b = await pup.launch(args);
b = await pw.firefox.launch(args);
p = await b.newPage();
if (opt.referer) {
if (lib.config().debug == true) console.log("[ez4] Going to referer URL first...");
if (lib.config.debug == true) console.log("[ez4] Going to referer URL first...");
await p.goto(opt.referer, {waitUntil