International Space Station

node v0.10.48
version: 0.0.1
endpointsharetweet
var myLocation = "San Francisco, CA"; var Promise = require('bluebird'); var moment = require('moment'); var _ = require('lodash'); var request = Promise.promisifyAll(require('request')); var geocode = Promise.promisifyAll(require('notebook')('capicue/geocode/2.0.0')); var issNowUrl = 'http://api.open-notify.org/iss-now.json'; var issPassUrl = 'http://api.open-notify.org/iss-pass.json'; var astrosUrl = 'http://api.open-notify.org/astros.json'; var body = await request.getAsync(issNowUrl); console.log("Current ISS Position"); JSON.parse(body[1]).iss_position;
var location = await geocode.lookupAsync(myLocation); var options = {lat: location.lat, lon: location.lng}; var result = await request.getAsync({url: issPassUrl, qs: options}); var timestamp = JSON.parse(result[1]).response[0].risetime; var time = moment.unix(timestamp); "The ISS will be above " + myLocation + " again " + time.fromNow();
var response = await request.getAsync(astrosUrl); var data = JSON.parse(response[1]); var people = _.map(data.people, function(person) { return person.name + " (" + person.craft + ")"; }); console.log("There are " + data.number + " people in space right now. "); console.log("They are " + people.join(", ") + ".");
Loading…

21 comments

  • posted 8 years ago by 57d86b3a53afa31400597415
    Hello World
  • posted 8 years ago by 57d9137b81f03814001dd72c
    noice
  • posted 8 years ago by 5802d4c6ac70ca0014d7801a
    wish i could could see the world from that perception
  • posted 8 years ago by ybouhjira
    hi
  • posted 7 years ago by 5827d41eca79740014170f4f
    fgdgfds
  • posted 7 years ago by 5864349dda298c00141112d4
    Cool
  • posted 7 years ago by 587faf53aabc770014e31715
    wow
  • posted 7 years ago by 589a6a68ae9e7d001447ac02
    this is insane
  • posted 7 years ago by kiwl21
    Speed up internet
  • posted 7 years ago by friedrichdsaccounty
    Awesome
  • posted 7 years ago by gxela
    Checkout the channel "World's Last Chance" on YouTube. The Earth is Flat! https://www.youtube.com/channel/UC79naBVmUyEFWNl7LA_VQDg
  • posted 6 years ago by ishwan
    awesome
  • posted 4 years ago by thecoder
    I need help lol
  • posted 2 years ago by 28443007
    mdkabir11224455@gmail.com
  • posted 2 years ago by soughman7979
    Hello World
  • posted 2 years ago by danielebarreto
    Olá
  • posted a year ago by tenggo8888
    hhehelhelhelo
  • posted a year ago by tenggo8888
    hrhhhrhhr VH
  • posted 6 months ago by symant233
    amazing
  • posted 5 months ago by nolovelies
    Here i am
  • posted 16 days ago by jeffhaji6
    , سردر نمیارم. اما چون یک تورک زبان هستم پس حتمآ از هوش بالایی برخوردارم، بزودی همه چیز را خواهم دانست

sign in to comment