-
Notifications
You must be signed in to change notification settings - Fork 1
Examples
Downloads PuTTY portable to the current directory.
endl.page('http://portableapps.com/apps/internet/putty_portable')
.find('a.download-link')
.then (container) ->
container.download( filenameMode: { predefined: 'putty_portable.exe' })
If you do page()
after find or findXpath, it will create a new Extractor instance with href
attribute of the first element from the first page as the first argument. (If you want to select another element, use index()
)
If you do download()
after find or findXpath, it will automatically download href
attribute of the first element.
Downloads Lame for Windows and installs it silently.
endl.page('http://lame.buanzo.org/')
.find('a[href^="http://lame.buanzo.org/Lame_"]')
.then (container) ->
container.download(
pageUrlAsReferrer: true
directory: './downloads'
filenameMode: { urlBasename: true }
)
.execute(['/VERYSILENT', '/NORESTART', '/LOG'])
Thanks to this blog for providing the arguments for silent install.
Downloads Request (NodeJS module) and change directory of ZIP to request-master
, extract all JS files to ./unzip
.
endl.file('https://github.com/request/request/archive/master.zip')
.download(pageUrlAsReferrer: true, filenameMode: { contentDisposition: true })
.extract(to: './unzip', cd: 'request-master', fileGlob: '*.js', maintainEntryPath: false)
This is just an example, you can use YAML too.
Create a file named test.json
{
"url": "http://www.mp3tag.de/en/download.html",
"find": "div.download a",
"filenameMode": ["urlBasename", "contentType"]
}
Require endl
and parse it with endl.load()
endl.load 'test.json'
Or just pass the JavaScript object:
endl.load JSON.parse fs.readFileSync 'test.json'