Aptoide APK Downloader

Changes the install button on Aptoid to download the apk.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name       Aptoide APK Downloader
// @version    2.0
// @namespace    Learning2Program
// @author       Learning2Program
// @homepage https://greasyfork.org/scripts/3454-aptoide-apk-downloader
// @description  Changes the install button on Aptoid to download the apk.
// @include      *aptoide.com*
// @require http://code.jquery.com/jquery-latest.js
// @run-at document-end
// ==/UserScript==
var url = window.location.href;

first = url.indexOf('/') + 2;
last = url.indexOf('.');
store = url.substring(first, last);

first = url.indexOf('/market/') + 8;
urll = url.slice(first);
last = urll.slice(0, urll.indexOf('/'));
appName = last;

string = document.getElementsByClassName('app_meta')[0].textContent.trim();
version = string.slice(string.indexOf(':') + 2, string.indexOf("|") - 1);
var destination = 'http://www.aptoide.com/webservices/getApkInfo/' + store + '/' + appName + '/' + version + '/xml';
console.log(destination);


var downloadIt = function() {
	window.location.href = apk;
};

GM_xmlhttpRequest({
	method: "GET",
	url: destination,
	onload: function(response) {
		var responseXMLs = new DOMParser().parseFromString(response.responseText, "text/xml");
		apk = responseXMLs.getElementsByTagName('path')[0].innerHTML;
		document.getElementsByClassName('btn app_install right trusted')[0].addEventListener('click', downloadIt);
	}
});