Message Boards Message Boards

Using GNU WGet to parse /input/?=flights+overhead and save the GIF

Posted 8 years ago

I'm hoping there is someone here who can offer some direction with this.

I'm trying to use WGet to save the default gif in the pod on the result page of http://www.wolframalpha.com/input/?i=flights+overhead

I keep coming into a block in that wget won't save anything before wolframalpha.com/input nor will it save the result which is in this directory:

http://www4b.wolframalpha.com/Calculate/MSP/MSP27423ab50600e17cd4g000043f4b03881ed7855?MSPStoreType=image/gif&s=10

The reason I need to be able to save the data in an image is so that we can overlay it on the stream of an all sky cam at this remote observatory.

Perhaps someone here can point me in the right direction, Maybe there is an easier way to go about this.

Is it possible to retrieve text from a query address? I need to be able to have a script run once a minute to grab the planes+overhead result, save the text or jpg to a folder and rename it.

We are running Windows so I can use robocoby to take care of the data once it comes in. I just need to be able to send some sort of query to Wolfram Alpha and have it return me a viable format.

I had gotten it to work late last night after many hours of work, but then Wolfram Alpha blocked my ip and I thought it didn't work in the morning and erased it only to find out it wasn't the program it was my IP being blocked due to all the activity from constant parsing and retrieving.

Now I can't get it to at all, I'm on a VPN, have been using teamviewer with different IPs testing.

But whatever code I had written last night will probably be lost to me for a long long time!

Maybe someone here is familiar with wget or can point me in the right direction?

Thanks,

David

POSTED BY: David Bradshaw
5 Replies
Posted 8 years ago

Here is a rudimentary solution using Phantom.js, which grabs a screen shot of an area of the webpage and outputs it to a file.

var page = new WebPage();
 page.viewportSize = { width: 1920, height: 1080 };
 //the clipRect is the portion of the page you are taking a screenshot of
 page.clipRect = { top: 450, left: 660, width: 470, height: 300 };
  page.open('http://www5b.wolframalpha.com/input/?i=flights+seen+from+current+geoIP+location',
    function (status) {
     just_wait();
       });

  function just_wait() {
     setTimeout(function() {
             page.render('planesoverhead.png');
             phantom.exit();
     }, 6000);
 }

I will update a more well thought out code in a few days that will grab the planes+overhead gif by element ID and save it as a whole.

The planes+overhead result gif changes size based on the total number of planes overhead at any particular time, meaning that a fixed resolution may not always include the full results.

POSTED BY: David Bradshaw
Posted 8 years ago

Hello Alexey,

Thank you for your reply. I Should have been more specific in my original post.

I was actually looking to get the planes+overhead chart that Identified names and altitudes of aircraft.

This chart would be useful at night for knowing which traveling dots overhead on the camera are "identified" and "unidentified" flying objects.

The plane map is also useful. But knowing the names of the flights would be most important at this time.

Unfortunately Mathematica costs hundreds of dollars and it that is not something we are willing to spend on this project.

I will continue testing with GNU Wget (which is free) and if I find the solution I will update this thread.

I'm sure there's a way to dissect the page for the plane identification chart.

Thanks,

David

Attachments:
POSTED BY: David Bradshaw
Posted 8 years ago

Hi David,

Most probably it is impossible to get this data using Wget but you have two possibilities:

1) Try to automate you browser in such a way that it will save this image or take a screenshot of what the browser displays.

2) Try free Mathematica Player. I cannot say for sure but this free application probably can access Wolfram|Alpha in the way shown in my previous answer. If it can, you can retrieve the data and take a screenshot of what is displayed in the player (the free version does not allow Exporting).

POSTED BY: Alexey Popkov

Home Edition of Mathematica is not that expensive. Also have you looked at Wolfram|Alpha API ? We think this might be exactly what you need and might not be expensive for your usage, but you will need to contact them for exact pricing via form on the linked page.

POSTED BY: Moderation Team
Posted 8 years ago

Hi David,

You don't need Wget for this, just get the map from Wolfram|Alpha using Mathematica directly:

skyMapImage = WolframAlpha["flights overhead New York", {{"SkyMap:FlightData", 1}, "Image"}]

image

Or you can get this image in vector form and then Export it as GIF or PNG with the resolution you want:

skyMap = WolframAlpha["flights overhead New York", {{"SkyMap:FlightData", 1}, "Cell"}]

Export["skymap.gif", Rasterize[skyMap, "Image", RasterSize -> 1000]]

image

(As you see, there are unfortunately some artifacts due to FrontEnd rendering bugs. I'm using version 10.3.1.)

POSTED BY: Alexey Popkov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract