The 0.7 release adds JSONiq support, grouping of command line options, new input/output formats, fixes html parsing/serialization, changes the syntax of extended strings and some other stuff
2012-11-06: New release
The 0.6 release adds XQuery support, the form and match functions, improves the Windows command-line interface, merges the two old cgi services to a single one and fixes several interpreter bugs
2012-09-05: Initial release of Xidel
First release of the VideLibri backend as stand-alone command-line tool
2010-08-29: Initial release
Release of a tiny cli example to test the pattern matching and XPath expressions of the Pascal Internet Tools / VideLibri backend on local files
Generally follow all links on a page and print the titles of the linked pages:
With XPath: xidel http://example.org -f //a -e //title
With CSS: xidel http://example.org -f "css('a')" --css title
With Templates: xidel http://example.org -f "<a>{.}</a>*" -e "<title>{.}</title>"
Another template example:
If you have an example.xml file like <x><foo>ood</foo><bar>IMPORTANT!</bar></x>
You can read the imporant part like: xidel example.xml -e "<x><foo>ood</foo><bar>{.}</bar></x>"
(and this will also check, if the part with the ood is there, and fail otherwise)
Calculate something with XPath:
xidel -e "(1 + 2 + 3) * 4 + 5 + 6 + 7"
Print all newest stackoverflow questions with title and url:
xidel --post "user=$your_username&passwd=$your_password&api_type=json" https://ssl.reddit.com/api/login --method GET 'http://www.reddit.com/api/me.json' -e 'jn:parse-json($raw)("data")("has_mail")'
Use XQuery, to create a html table of odd and even numbers:
Windows: xidel --xquery "<table>{for $i in 1 to 1000 return <tr><td>{$i}</td><td>{if ($i mod 2 = 0) then 'even' else 'odd'}</td></tr>}</table>" --output-format xml
Linux: xidel --xquery '<table>{for $i in 1 to 1000 return <tr><td>{$i}</td><td>{if ($i mod 2 = 0) then "even" else "odd"}</td></tr>}</table>' --output-format xml (xidel itself supports ' and "-quotes on all platforms, but ' does not escape <> in Windows cmd, and " does not escape $ in the Linux shells)
Usually you can just extract the zip/deb and call Xidel, or copy it to some place in your PATH,
because it consists of a single binary without any external dependencies, except the standard system libraries (i.e. Windows API or respectively libc).
However, for https connections on Linux openssl and libcrypto (or even openssl-dev?) are also required.
The source is stored in a mercurial repository together with the VideLibri source.
The program is written in FreePascal/Lazarus, so you need these to compile it.
With the source from the repository, it should be possible to just open the project file xidel.lpi (in the programs/internet/xidel directory) in Lazarus and click on Run\Compile.
If that fails, because it complains about missing packages, you first need to register the packages in Lazarus, by opening the components/pascal/internettools.lpk and components/pascal/import/utf8tools/utf8tools.lpk files and clicking the "Use/Install" button.
In the source tar ball, the paths are not fully correct (absolute instead relative) and a package file is missing. So before compiling the xidel.lpi, you need to open the "project options" dialog to add the "other unit file" paths to all subdirectories in the components/pascal directory and open the "project inspector" to remove the dependency on "internet tools" (alternatively, you can download the internet tools package from my homepage, but that should not be necessary, once the paths are set).
It is also possible to compile it on Mac: There you need the newest version of the synapse library (the version included in the Xidel source is not mac-compatible), then you can compile it as described here. There you can find a prebuilt mac version.
There is also a Greasemonkey script to automatically generate templates by selecting the interesting values on a webpage. The script intercepts the selection and marks the elements as shown in the screenshots below:
You can find the script in the mercurial repository or on userscripts.org with a detailed description.