getBTC

quick simple test function to get bitcoin price

目前为 2019-05-13 提交的版本。查看 最新版本

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/382976/697626/getBTC.js

function getBTC(){
    var price = get("https://api.coindesk.com/v1/bpi/currentprice.json");
    return price;
}

function get(url)
{
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", url, false );
    xmlHttp.send( null );
    return xmlHttp.responseText;
}