branchard / fast-speedtest-api Goto Github PK
View Code? Open in Web Editor NEWfast.com API / CLI tool
Home Page: https://npmjs.com/fast-speedtest-api
License: GNU General Public License v3.0
fast.com API / CLI tool
Home Page: https://npmjs.com/fast-speedtest-api
License: GNU General Public License v3.0
`
speedTestMbps().then(res=> console.log(res)); //Test net speed.
const FastSpeedtest = require("fast-speedtest-api");
//Returns float for Mbps
//'timeout' miliseconds tests for how long the data download speed was tested.
async function speedTestMbps(msg) {
let speedtest = new FastSpeedtest({
token: "YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm", // required
verbose: false, // default: false
timeout: 10000, // default: 5000
https: true, // default: true
urlCount: 5, // default: 5
bufferSize: 8, // default: 8
unit: FastSpeedtest.UNITS.Mbps // default: Bps
});
try {
const s = await speedtest.getSpeed();
console.log(`Speed: ${s} Mbps`);
return s;
} catch (e) {
console.error(e.message);
}
}
`
Here is the Error.
Access to fetch at 'https://api.fast.com/netflix/speedtest?https=true&token=https://ipv4-c001-cgy001-globetelecom-isp.1.oca.nflxvideo.net/speedtest/range/0-0?%0A%20%20c=ph&n=132199&v=5&e=1588413106&t=gdamowYVB5mkSSmTJaaAgdxhJWo&urlCount=5' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
This package uses Fast.com's private API.
(Fast.com is a public site by Netflix. It runs on their infrastructure)
I have not been able to find any evidence that they allow their API to be used by third parties.
Is using this package legal?
I am trying to implement this in an exe file, however, using pkg did not work. Why? How can I fix this issue?
Is it possible to run this typescript process? Requesting ability to provide a .d.ts written statement
I have my network made of multiple ISP connections. How can i use the API to test the speed, latency, jitter of multiple ISP connections
Have you considered updating the package to allow options as to which statistic(s) to return, e.g.,
speedtest.getStats({ statistics: [ 'download', 'upload', 'latency' ]}).then(stats => {
// examine stats.download, stats.upload, stats.latency, all in stats.unit
}).catch(e => { console.error(e.message); });
just a thought, thanks!
In verbose mode, all the download speeds are available and logged in the console. Is there anyway to get the values as a response from the promise? i want to stream all the values to a client through WS
Just made some changes on getTargets() to update to fast api V2, replaced the "while contents" with this
while (targets.length < this.urlCount) {
/* eslint-disable no-await-in-loop */
const { response } = await this.get(`http${this.https ? 's' : ''}://api.fast.com/netflix/speedtest/v2?https=${this.https ? 'true' : 'false'}&token=${this.token}&urlCount=${this.urlCount - targets.length}`);
/* eslint-enable no-await-in-loop */
if (response.statusCode !== 200) {
if (response.statusCode === 403) {
throw new ApiError({ code: ApiError.CODES.BAD_TOKEN });
}
throw new ApiError({ code: ApiError.CODES.UNKNOWN });
}
targets.push(...response.data.targets);
}
Can this plugin be used with angular...???
please is there any other way around to solve this problem and integrate this package with Angular 6...!!!
Hi, I notice that the way to get the token is to take one from fast.com and use it. I want to run a speedtest nightly, I assume that just taking one now and using it for forever won't work. Is there any known expiration on the token? Do I need to first fetch one always and then run the speedtest?
i tested with 2 MBPS speed and the result from this module was between 500-900mbps
and same result in higher speed.
Also the result shown from fast.com doesnot match with result with this API
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.