• 27-03-2024, 15:42:44
    #1
    'use strict';

    function _typeof(obj) {
    return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
    return typeof obj
    } : function(obj) {
    return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj
    }, _typeof(obj)
    }
    var url = require("url"),
    Host = module.exports;
    Host.alias = ["rg.to"], Host.autoDeleteAccount = !0;
    var useAPI = !1;
    Host.login = function(username, password, callback) {
    var j = rp.jar(),
    loginUrl = "https://rapidgator.net/auth/login";
    rp({
    uri: loginUrl,
    method: "POST",
    form: {
    "LoginForm[email]": username,
    "LoginForm[password]": password,
    "LoginForm[rememberMe]": 1
    },
    jar: j
    }).then(function(body) {
    var cookie = j.getCookieString(loginUrl);
    return /Invalid auth code/.test(body) ? callback(new Error("Invalid auth code")) : void callback(null, cookie)
    }).catch(function(err) {
    callback(err)
    })
    }, Host.check = function(cookie, callback) {
    rp = rp.defaults({
    headers: {
    cookie: cookie + ";lang=en"
    }
    }), rp("https://rapidgator.net/profile/index").then(function(body) {
    if (/premium">Free</.test(body)) return callback(new Error("Account free"));
    var t1 = body.lastIndexOf("Bandwith available</td>"),
    t2 = body.lastIndexOf("<td>Number of files</td>"),
    str = body.substring(t1, t2),
    regex = /<td>n(.*)</br/gm,
    match = regex.exec(str);
    return match ? callback(null, !0, "Bandwith available: " + match[1].trim()) : callback(new Error("Invalid account"))
    }).catch(function(err) {
    callback(err)
    })
    }, Host.download = function(link, cookie, callback) {
    var j = request.jar(),
    options = {
    uri: link,
    method: "HEAD",
    followRedirect: !0
    };
    request(options, function(err, res) {
    return err ? callback(err) : 503 === res.statusCode ? callback(new Error("Account limit")) : 400 <= res.statusCode ? callback(new Error("Link dead")) : void("" !== this.uri.href && (link = this.uri.href), options.uri = link, options.headers = {
    Cookie: cookie
    }, options.followRedirect = !1, options.method = "GET", options.jar = j, request(options, function(err, res, body) {
    if (503 === res.statusCode) return callback(new Error("Account limit"));
    if (400 <= res.statusCode) return callback(new Error("Link dead"));
    var file_cookie = j.getCookieString(options.uri);
    if (res.headers && "undefined" != typeof res.headers.location) return callback(null, {
    cookie: file_cookie,
    download: res.headers.location
    });
    var urlParse = url.parse(link),
    url_antifrodDownloadLog = "https://rapidgator.net/antifrod/SaveDownloadLog";
    url_antifrodDownloadLog = url_antifrodDownloadLog.replace("http:", urlParse.protocol);
    var regex = /var fid =(.*);/gm,
    match = regex.exec(body);
    if (!match) return callback(new Error("Link dead"));
    var fid = match[1].trim(),
    regex2 = /premium_download_link = '(.*)';/gm,
    premium_download_link = "",
    match2 = regex2.exec(body);
    if (match2) premium_download_link = match2[1].trim();
    else return callback(new Error("Link dead"));
    return "" === premium_download_link ? callback(new Error("Account limit")) : void(options.uri = url_antifrodDownloadLog, options.method = "POST", options.form = {
    fid: fid
    }, request(options, function(err) {
    return err ? callback(err) : callback(null, {
    cookie: file_cookie,
    download: premium_download_link
    })
    }))
    }))
    })
    };
    var API;


    Bu eklenti şuan çalışmıyor bunları düzeltip, bu ve buna benzer siteler için bu eklenti formatında kodlayabilir misiniz?
  • 27-03-2024, 15:47:47
    #2
    @eypoffcl;
  • 27-03-2024, 15:50:58
    #3