Greasy Fork

Greasy Fork is available in English.

Direct download from Google Play

Adds APKPure, APKMirror, APK-DL and Evozi download buttons to Google Play when browsing apps. This script is based on yurenchen's "google play apk downloader".

当前为 2018-03-17 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Direct download from Google Play
// @namespace    StephenP
// @version      1.8.1
// @description  Adds APKPure, APKMirror, APK-DL and Evozi download buttons to Google Play when browsing apps. This script is based on yurenchen's "google play apk downloader".
// @author       StephenP
// @match        https://play.google.com/*
// @match        http://play.google.com/*
// @grant        none
// ==/UserScript==
var wlButton;
var pageURL;
(function() {
    'use strict';
    pageURL=location.href;
    if(pageURL.includes("details?id=")){
       addButtons();
    }
    setInterval(checkReload, 3000);
})();
function checkReload(){
    if(pageURL!=location.href){
        //alert(document.getElementById("apkdlbutton"));
        while(document.getElementById("apkdlbutton")!==null){//se ci sono ancora i pulsanti
            setTimeout(function(){},1000);
        }
        if(document.getElementsByClassName("play-logo").length>0){//esistono le vere classi html?
            while(document.getElementsByClassName("buy-button-container")===null){
                setTimeout(function(){},1000);
            }
        }
        else{
        }
        //alert(pageURL+" vs. "+location.href);
        if(location.href.includes("details?id=")){
            addButtons();
        }
        pageURL=location.href;
        wlButton=null;
    }
}
function addButtons(){
    var price=-1;
    var installButton=null;
            try{
                installButton=document.getElementsByClassName("buy")[0];
                price=installButton.firstElementChild.firstElementChild.getElementsByTagName("META")[1].content;
            }
            catch(err){
                try{
                    installButton=document.body.firstChild.children[5].children[1].firstChild.children[2].firstChild.firstChild.firstChild.firstChild.firstChild.children[2].children[1].firstChild.firstChild.firstChild;
                    price=installButton.firstElementChild.firstElementChild.getElementsByTagName("META")[1].content;
                }
                catch(err){
                    installButton=document.body.firstChild.children[6].children[1].firstChild.children[1].firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.children[1].firstChild.children[1].firstChild.children[1].children[1].firstChild.firstChild.firstChild;
                    price=installButton.firstElementChild.firstElementChild.getElementsByTagName("META")[1].content;
                }
            }
        if(price==0){
            var html;
            var buttonslist;
            var id=location.search.match(/id=(.*)/)[1].split("&", 1);
            var apkpureURL='https://m.apkpure.com/genericApp/'+id+'/download';
            var evoziURL='https://apps.evozi.com/apk-downloader/?id='+id;
            var apkdlURL='http://apkfind.com/store/captcha?app='+id;
            var apkmirrorURL='https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s='+id;
            var menubutton=-1;
            try{
                menubutton=document.getElementsByClassName("action-bar-menu-button").length;
            }
            catch(err){
            }
            wlButton = document.createDocumentFragment();
            var wishListButton=installButton.parentNode.parentNode.parentNode.parentNode.firstChild;
            wlButton.appendChild(wishListButton);
            if(document.getElementsByClassName("play-logo").length>0){//esistono le vere classi html?
                if(menubutton>0){ //menubutton==0 means there is no sliding menu, an element only occurring in mobile view.
                    buttonslist = document.getElementsByClassName("details-actions")[0];
                    html='<span id="apkpurebutton"><a style="background-color: #24cd77" class="medium play-button download-apk-button apps ">APKPure</a></span><span id="apkdlbutton"><a href="'+apkdlURL+'" style="background-color: #009688" class="medium play-button download-apk-button apps ">APK-DL</a></span><span><a href="'+evoziURL+'" style="background-color: #286090" class="medium play-button download-apk-button apps ">Evozi</a></span><span><a href="'+apkmirrorURL+'" style="background-color: #FF8B14" class="medium play-button download-apk-button apps ">APKMirror</a></span>';
                }
                else if(menubutton==0){
                    buttonslist = document.getElementsByClassName("details-actions-right")[0];
                    html='<span id="apkpurebutton"><p style="background-color: #24cd77" class="large play-button download-apk-button apps ">APKPure</p></span><span id="apkdlbutton"><a href="'+apkdlURL+'" style="background-color: #009688" class="large play-button download-apk-button apps ">APK-DL</a></span><span><a href="'+evoziURL+'" style="background-color: #286090" class="large play-button download-apk-button apps ">Evozi</a></span><span><a href="'+apkmirrorURL+'" style="background-color: #FF8B14" class="large play-button download-apk-button apps ">APKMirror</a></span>';
                }
            }
            else{
                buttonslist = installButton.parentNode.parentNode.parentNode.parentNode;
                html='<span id="apkpurebutton"><a style="background-color: #24cd77" class="medium play-button download-apk-button apps ">APKPure</a></span><span id="apkdlbutton"><a href="'+apkdlURL+'" style="background-color: #009688" class="medium play-button download-apk-button apps ">APK-DL</a></span><span><a href="'+evoziURL+'" style="background-color: #286090" class="medium play-button download-apk-button apps ">Evozi</a></span><span><a href="'+apkmirrorURL+'" style="background-color: #FF8B14" class="medium play-button download-apk-button apps ">APKMirror</a></span>';
            }
            buttonslist.innerHTML=buttonslist.innerHTML+html;
            buttonslist.appendChild(wlButton);
            var apkpureButton=document.getElementById("apkpurebutton");
            apkpureButton.onclick=function(){pureDDL(apkpureURL);};
        }
}
function pureDDL(apkpureURL){
    try{
        document.body.removeChild(document.getElementById('apkpureFrame'));
    }
    catch(err){
    }
    finally{
        var hiddenFrame=document.createElement("iframe");
        hiddenFrame.style.width="0";
        hiddenFrame.style.height="0";
        hiddenFrame.setAttribute('id', 'apkpureFrame');
        hiddenFrame.setAttribute('src', apkpureURL);
        hiddenFrame.setAttribute('frameborder', "0");
        document.body.appendChild(hiddenFrame);
    }
}