Pau Rosello 2b37a0133a Non root user and fwatchdow standarization
AlpineFunction additional Dockerfiles
Fix Coffe, node nonroot user and change workdir
DnCore nonroot and updated to 2.1, new README
Fix golang user and watchdog
Java user and watchdog fix
Watchdog and user for node image
Fix python user and watchdog
Fix R username and watchdog
Captainsintent user and fwatchdog
ChangeColorIntent change username, fwatchdog and directory
CHelloWorld remove tmp, disabled lock, fwatchdog and user
DockerHubStats user, fwatchdog and dependencies
Change figlet to use base alpine image
Improve figlet ARM
Set base image GIF-Maker
MarkDownRender change base image
NodeInfo change base image
PhantomJS user and fwatchdog
Resize Image
SentimentAnalysis user and watchdog
WebhookStach change root image
Replace user faas with app
Upgrade alpine to latest version
Revert vendor folders
Upgrade alpine:3.9
2019-07-11 22:17:57 +01:00
..

Phantomjs function

Phantomjs is a headless web-browser used for scraping and automation testing. This function will scrape a web-page with the JavaScript sent in through the function.

Once a function has been deployed to FaaS using the UI or one of the other methods you can invoke it with a JavaScript Phantomjs file.

Image name: functions/base:phantomjs

You can use the existing Docker image that is managed through this project.

Create the function through the FaaS CLI:

# curl -sSL https://get.openfaas.com | sudo sh

# faas-cli -action=deploy -image=functions/base:phantomjs -name=phantomjs \
  -fprocess="phantomjs /dev/stdin"
200 OK
URL: http://localhost:8080/function/phantomjs

Example usage:

$ time curl --data-binary @cnn.js http://localhost:8080/function/phantomjs

Status: success
CNN - Breaking News, Latest News and Videos

real    0m8.729s

This script visits the front page of CNN and once it is fully loaded - scrapes the title.

See cnn.js as an example of a Phantomjs script.

Another example script feedly_subscribers.js gives the count of subscribers for an RSS Feed registered on Feedly.