mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-17 01:32:22 +02:00
Updated README.
This commit is contained in:
27
.travis.yml
27
.travis.yml
@ -1,11 +1,24 @@
|
||||
language: go
|
||||
|
||||
sudo: required
|
||||
|
||||
os:
|
||||
- linux
|
||||
|
||||
go:
|
||||
- "1.8"
|
||||
- "1.9"
|
||||
- "1.10"
|
||||
- "1.11"
|
||||
- master
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- oracle-java8-set-default
|
||||
|
||||
before_install:
|
||||
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
||||
|
||||
go:
|
||||
- "1.8"
|
||||
- "1.9"
|
||||
- "1.10"
|
||||
- "1.11"
|
||||
- master
|
||||
- sudo curl -O http://www.antlr.org/download/antlr-4.7.1-complete.jar
|
||||
- export CLASSPATH=".:/home/travis/build/christoph2/pyA2L/antlr-4.6-complete.jar:$CLASSPATH"
|
||||
- alias antlr4='java -jar /usr/local/lib/antlr-4.7.1-complete.jar'
|
25
README.md
25
README.md
@ -8,6 +8,31 @@
|
||||
Having it's own declarative language, ```ferret``` abstracts away technical details and complexity of the underlying technologies, helping to focus on the data itself.
|
||||
It's extremely portable, extensible and fast.
|
||||
|
||||
## Give me an example
|
||||
The following example demonstrates use of dynamic pages.
|
||||
Here we are getting the top songs from SoundCloud.
|
||||
Since the page is rendered dynamically, there data doesn't get showed up immediately.
|
||||
Therefore, we need to handle it.
|
||||
First, we load the document with ``true`` flag, which instructs ``ferret`` to load this page using Chrome.
|
||||
Second, we wait for a specific element gets rendered.
|
||||
Third, once it appears we get all elements with this class name and iterate over the elements extracting data.
|
||||
|
||||
```aql
|
||||
LET doc = DOCUMENT('https://soundcloud.com/charts/top', true)
|
||||
|
||||
WAIT_ELEMENT(doc, '.chartTrack__details')
|
||||
LET tracks = ELEMENTS(doc, '.chartTrack__details')
|
||||
|
||||
FOR track IN tracks
|
||||
LET username = ELEMENT(track, '.chartTrack__username')
|
||||
LET title = ELEMENT(track, '.chartTrack__title')
|
||||
|
||||
RETURN {
|
||||
artist: username.innerText,
|
||||
track: title.innerText
|
||||
}
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
* Declarative language
|
||||
|
Reference in New Issue
Block a user