Downloading XLS from URL - javascript

I'm trying to pull data, using an Ubuntu 16.04LTS server, from a website that uses JavaScript to export data into an XLS file.
https://www.adfg.alaska.gov/sf/FishCounts/index.cfm?ADFG=main.displayResults
Has a link called Export as Excel Spreadsheet
which gives you this link here
https://www.adfg.alaska.gov/sf/FishCounts/index.cfm?ADFG=export.excel&countLocationID=40&year=2017&speciesID=420
I tried using the command user$ wget rhino -weblink-
but it compiles with errors 79 Errors.
I don't know very much about programming, I'm just trying to automatically pull the data on a daily basis, and run a BASH script that calculates data from the spreadsheet for me.

Norrin
That URL worked properly without JS execution.
Here is the command that I use:
curl -L -o FishCount.xls 'https://www.adfg.alaska.gov/sf/FishCounts/index.cfm?ADFG=export.excel&countLocationID=40&year=2017&speciesID=420'
Be careful that use the single-quote to wrap URL. Otherwise BASH/SHELL will misinterpret & as background process.

Related

Is there a way to run a js. parser in python and retrieve the data?

Sorry if this isn't super clear, as I'm not quite sure how to go about this. There is a parser on github that allows you to listen to a game and then show its realtime data with a powershell command. How would I go about running the .js file in python and then gathering its information?
These are the instructions to run it that are given on the github page:
"### Reading live files
To use the above script, do the following:
Open a terminal prompt in the folder containing the script file and the package.json file
Run yarn to fetch the dependencies
Run node realtimeFileReads.js "C:\mirror\output\path" replacing the path argument with where your connected console outputs replay files to
At this point, you should see an output as you play games on the connected console."
If there are questions I'd be happy to answer, as I'm sure it might need some more context.

Node.js or Ubuntu Linux run cron on server start up

So I have a node server on Ubuntu and I want it to
unzip a file that gets uploaded from ftp,
read a text file inside, and then
save the information to mongodb every day at 4am.
I'm a bit confused on whether I should let ubuntu do that or have my node server do that because I feel like this is a little bit of both: unzipping files to folder is easier with bash and reading and saving to mongodb is easier with javascript (for me).
Any suggestion on how I can approach this?
If you use https://github.com/EvanOxfeld/node-unzip you can get the file and data from the zip file, then use node to save it.
Though you could also probably use both, use bash to unzip and get the file name then send it as a parameter to the node file and run it, all through bash.

JavaScript D3 Data visualization [duplicate]

I know that D3.js supports loading data files with XHR and JSONP requests.
However in my case, I am going to run .html files by double clicking on them from filesystem, which is going to run it like file://.../foo.html on browser.
Is it possible to load data file (csv or json) within the same directory from computer as foo.html on browser (while not running on http:// but file://)?
The best solution would be to run a server on your computer to make it work.
The simplest way to have a local web server, as explained here is to run this command in the directory where you have your source code:
python -m SimpleHTTPServer 8888 &
Then just load the page http://localhost:8888
You can by disabling the respective security mechanisms in your browser. I think it works in Opera by default, and you can start Chrome with the --allow-file-access-from-files command line flag to allow loading data from file://.
Adding onto Christopher Chiche's answer (I am a new user, can't comment).
For python 3 in Windows, that command does not work. Instead use this one
python -m http.server [<portNo>]
As described here, in python 3
the module SimpleHTTPServer has been replaced by http.server, at least in Windows.
Similar to the python answer from Christopher Chiche above, you can also use the built-in server that comes with various versions of PHP.
php -S localhost:8888 &
This was more useful for me, as my application has hooks to a php back-end script as well as the d3 front-end.

node.js command line file excel on web server

My script in node.js generate a excel file, I need to put this file available on web server like web url and people can download it directly. Right now, script generate a excel file and it is available in windows folder. Thanks
If you really want to use nodejs for this you can use something like "static-server" and create a server that will export everything from you'r folder to the "web"..
But much better approach is to do it throught nginx or apache.
You can google with keywords "static [file] server (nginx|apache|nodejs)".

Running a local server with javascript

I want to create a simple Javascript program with a HTML interface. The program will run in Chrome. I will also use node-serialport and Node.js to comunicate with an Arduino. I have a HTML and JavaScript file done, but I have no clue how to run it, or how to implement Node.js or node-serialport, nor how to "start" the sever. Initially it will only be running locally, but eventually it may become a real sever. For now, how do I run all that locally?
EDIT: I'm using the sample code from http://brandontilley.com/2012/03/02/controlling-an-arduino-from-nodejs.html, with the CoffeeScript converted into JavaScript.
Lucas, glad you found the blog post useful; perhaps I should add this information to it.
Getting the sketch into your Arduino
Just fire up the Arduino application, paste in the sketch code, and hit "Upload." Should be all you need to do here.
Starting the Node.js Server
What operating system are you using this on? Finding out how to access your Arduino microcontroller via node-serialport will differ based on your OS.
In the source code, change the string value of port to be your Arduino's device (once you know it). Also, the script depends on Express and (of course) node-serialport from NPM, so run npm install express serialport in the directory where your JavaScript file is saved. Finally, run the file with node server.js (assuming server.js is the name of your file). Then you can access the server at http://localhost:8080.
You can use node.js to serve up HTML with Express. If your main Javascript file is called server.js, then run it by typing:
node server.js
at the command line.

Categories

Resources