// ==UserScript== // @name Direct download from Google Play // @namespace StephenP // @version 2.7.1 // @description Adds APK-DL, APKPure, APKMirror 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/* // @match http://apkfind.com/store/captcha?app=* // @grant GM.xmlHttpRequest // @grant GM.download // @connect self // @connect apkpure.com // @connect apkfind.com // @connect apk-cloud.com // @connect winudf.com // @connect apkcombo.com // @connect googleapis.com // @icon https://play.google.com/favicon.ico // @downloadURL none // ==/UserScript== var ui; var wlButton; var pageURL; var title; var appCwiz; var done=[0]; (function() { if(document.location.href.includes("apkfind")===true){ setInterval(unredirect,100); } else{ try{ 'use strict'; var site=window.location.href.toString(); ui=checkUI(); pageURL=location.href; title=document.getElementById("main-title").innerHTML; if(ui>=3){ var buttonsStyle=document.createElement("style"); var styleString='.ddlButton:visited{color: white;} .ddlButton:hover{opacity: 0.8;} .ddlButton:active{opacity: 0.6;} .ddlButton{color: white; border-radius: 4px; border: 1px; font-size: 14px; height: 46px; padding: 9px 20px; font-weight: 500; font-family: "Roboto",sans-serif; position: relative; text-align: center; line-height: 46px;'; if(ui==3){ styleString+=' margin-right: 4px;}'; buttonsStyle.innerHTML=styleString; } if(ui==4){ styleString+=' margin-left: 4px;}'; buttonsStyle.innerHTML=styleString; } document.body.appendChild(buttonsStyle); } if(pageURL.includes("details?id=")){ addButtons(); } setInterval(checkReload, 2000); } catch(err){ console.log("main(): "+err); } } })(); function unredirect(){ var tot=document.body.children.length-1; if(parseInt(document.body.children[tot].style.zIndex, 10)>2){ if(document.body.children[tot].id==""){ document.body.children[tot].style.zIndex="1"; document.body.children[tot-1].style.zIndex="-1000"; } else{ document.body.children[tot].style.zIndex="-1000"; } } } function waitForRemovingButtons(){ //if(title!=document.getElementById("main-title").innerHTML){ if((pageURL!=location.href)||(isButtonVisible()===false)){ title=document.getElementById("main-title").innerHTML; pageURL=location.href; wlButton=null; if(location.href.includes("details?id=")){ if((ui>=3)&&(document.getElementsByClassName("ddlButton").length>0)){ try{ removePreviousCwiz(); } catch(err){ console.log(err+"; I was probably just trying to remove buttons that weren't there..."); } } addButtons(); } } else{ setTimeout(waitForRemovingButtons, 1000); } } function checkReload(){ if((pageURL!=location.href)||(isButtonVisible()===false)){ waitForRemovingButtons(); } } function isButtonVisible(){ var allButtons=document.getElementsByClassName("ddlButton"); //console.log("how many buttons: "+allButtons.length); if(allButtons.length>0){ for(var i=0;iEvoziAPKMirror'; } else if(ui==2){ buttonslist = document.getElementsByClassName("details-actions-right")[0]; html='APK-DLAPKPureAPKCombo
EvoziAPKMirror'; } else{ buttonslist = installButton.parentNode; html='APK-DLAPKPureAPKCombo
EvoziAPKMirror'; } if(ui<=2){ wlButton.appendChild(wishListButton); } else{ if(typeof wishListButton!=='undefined'){ wlButton.appendChild(wishListButton.firstChild.firstChild); } } buttonslist.innerHTML=buttonslist.innerHTML+html; buttonslist.appendChild(wlButton); var ddlButton1=document.getElementById("apkdlbutton"); ddlButton1.onclick=function(){ddl(this,apkdlURL);}; var ddlButton2=document.getElementById("apkpurebutton"); ddlButton2.onclick=function(){ddl(this,apkpureURL);}; var ddlButton3=document.getElementById("apkcombobutton"); ddlButton3.onclick=function(){ddl(this,apkcomboURL);}; } } function openLink(link){ window.open(link,"_self"); } function ddlFinalApk(link,ddlButton,i){ if(link!=""){ done[i]=0; GM.xmlHttpRequest({ method: "GET", url: link, timeout: 5000, ontimeout: function(response) { if(done[i]==0){ ddlButton.firstChild.innerHTML="Retry"; } else{ done[i]=0; } }, onprogress: function(response){ //console.log(response.finalUrl); if((response.finalUrl.includes("winudf.com"))||(response.finalUrl.includes("down-apk.com"))||(response.finalUrl.includes("/play-apps-download-default/"))){ if(done[i]==0){ console.log("downloading file n."+i); done[i]=1; if(link.includes("apkpure")){ window.open(response.finalUrl,"_self"); ddlButton.onclick=function(){openLink(response.finalUrl);}; ddlButton.firstChild.innerHTML="Ready!"; } else{ window.open(response.finalUrl,i); ddlButton.firstChild.innerHTML="APKCombo"; } } } }, onload: function(response){ if(done[i]==0){ ddlButton.firstChild.innerHTML="Retry"; } else{ done[i]=0; } } }); } else{ ddlButton.firstChild.innerHTML="Failed!"; ddlButton.firstChild.style.backgroundColor="#CCCCCC"; ddlButton.onclick=null; } } function ddl(ddlButton,ddlURL){ ddlButton.firstChild.innerHTML="Loading..."; if(ddlURL.includes("apkfind")){ try { var apkDlRequest1=GM.xmlHttpRequest({ method: "GET", url: ddlURL, onload: function(response) { if(response.finalUrl.includes("/captcha?")){ ddlButton.firstChild.setAttribute("href",response.finalUrl); ddlButton.firstChild.innerHTML="CAPTCHA"; ddlButton.onclick=null; } else if(response.finalUrl.includes("app/removed")){ ddlButton.firstChild.style.backgroundColor="#CCCCCC"; ddlButton.firstChild.innerHTML="Removed!"; ddlButton.onclick=null; } else{ try{ var linkIntermediary = document.createElement("html"); linkIntermediary.innerHTML=response.response; var link="http:"+linkIntermediary.getElementsByClassName("mdl-button")[0].getAttribute("href"); ddlButton.firstChild.innerHTML="Ready!"; openLink(link); ddlButton.onclick=function(){openLink(link);}; } catch(err){ ddlButton.firstChild.innerHTML="Failed!"; ddlButton.firstChild.style.backgroundColor="#CCCCCC"; ddlButton.onclick=null; console.log(err); } } } }); } catch (err) { ddlButton.firstChild.innerHTML="Failed!"; ddlButton.firstChild.style.backgroundColor="#CCCCCC"; ddlButton.onclick=null; console.log(err); } } else if(ddlURL.includes("apkpure")){ try{ GM.xmlHttpRequest({ method: "GET", url: ddlURL, onload: function(response) { var apklink=response.responseText.substr(response.responseText.indexOf('https://download.apkpure.com/b/'),response.responseText.length-1); apklink=apklink.substr(0,apklink.indexOf('"')); console.log(ddlURL); ddlButton.firstChild.innerHTML="Wait..."; //ddlButton.onclick=function(){GM.openInTab(apklink,"open_in_background");}; ddlFinalApk(apklink,ddlButton,0); } }); } catch(err){ ddlButton.firstChild.innerHTML="Failed!"; ddlButton.firstChild.style.backgroundColor="#CCCCCC"; ddlButton.onclick=null; console.log(err); } } else if(ddlURL.includes("apkcombo")){ try{ GM.xmlHttpRequest({ method: "GET", url: ddlURL, onload: function(response) { try{ var i; var parser = new DOMParser(); var resp = parser.parseFromString(response.responseText, 'text/html'); /*var combo=resp.getElementById("apkcombo-server"); if(combo!==null){ var combolinks=[]; for(i=0;i0){ check=1; } else{ if(document.getElementsByClassName("details-info").length>0){ check=2; } else{ check=4; var metaTags=document.head.getElementsByTagName("meta"); for(var i=0;i