Simple web crawling DSL interpreter
260
Simple web crawling DSL interpreter.
This DSL supports few statements and uses indentation for blocks.
Prints given message, for debugging
debug Hello\ World
Fetches JSON from given resource and binds value to a named variable
fetch c https://someapi.com/cities.json
debug Total:\ {c.length}\ cities
Where:
c variable namehttps://someapi.com/cities.json JSON sourceIterate over values at given JSON path (must be an Array).
foreach row c.images
debug Row.id:\ {row.id}
Where:
row variable name for element valuec.images list variable reference (name: c and $.images json path)Downloads remote file to local path.
download https://somapi.com/cities/{c.id}.json /tmp/cities/{c.id}.json
Where:
https://somapi.com/cities/{c.id}.json source file url/tmp/cities/{c.id}.json path to local fileSet concurrency level for child block statements.
concurrently 8
debug Concurrency\ level\ is\ 8\ here
debug Starting...
fetch h https://somedmoeapi.com/some/list.json
concurrently 8
foreach c h.cities
debug id:\ {c.id}
download https://publiccitiesapi.com/{c.id}/image.png /tmp/cities/{c.id}/image.png
debug Done.
cat sample.hit | docker run -i --rm lostintime/hittassign-back:1.0
All code in this repository is licensed under the Apache License, Version 2.0. See LICENCE.
Content type
Image
Digest
Size
77.5 MB
Last updated
over 8 years ago
docker pull lostintime/hittassign-back