GithubHelp home page GithubHelp logo

branchard / fast-speedtest-api Goto Github PK

View Code? Open in Web Editor NEW
161.0 161.0 38.0 269 KB

fast.com API / CLI tool

Home Page: https://npmjs.com/fast-speedtest-api

License: GNU General Public License v3.0

JavaScript 100.00%
api cli fast speedtest speedtest-cli

fast-speedtest-api's People

Contributors

branchard avatar jeromelachaud avatar michaelhirn avatar siopy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fast-speedtest-api's Issues

Example use as the documentation is not good:

`

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);
}

}

`

Failed to Fetch: CORS Policy problem

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.

Is this package legal?

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?

Un-pkg-able

I am trying to implement this in an exe file, however, using pkg did not work. Why? How can I fix this issue?

Latency and Upload speed?

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!

Get all values in verbose mode

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

update to fast api V2

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);
    }

Angular Integration

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...!!!

How long does the token last?

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?

Speed doesnot change in low internet speed

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.