XML parsing is often left to programming languages, not for command line use or in shell scripts. Here I used XMLStarlet Command Line XML Toolkit a wonderful set of tools that brings power of handling XML to commandline and Wget to download the content. The xmlstarlet tool seeks the URL’s in XML feed and passes it to wget.
/usr/bin/wget -c `/usr/bin/xmlstarlet sel --net -D -T -t -m "/records/movieinfo/preview" -v "large" -o " " http://www.apple.com/trailers/home/xml/current.xml`
These two programs are ported and available for other operating systems. The wget “-c” (continue) is optional. You can use any other downloader instead of wget. I suggest curl
No comments:
Post a Comment
You can leave a comment here using your Google account, OpenID or as an anonymous user.