xkcd Example
This .comic file downloads the popular web comic xkcd. It puts the comic and title text on the users desktop and places a copy of the comic in ~/Pictures/XKCD for archiving. This is written in the format COMMAND - DESCRIPTION
name(XKCD) - Set the comic name to XKCD for collecting last run data
get_location(http://www.xkcd.com) - Downloads the home page of www.xkcd.com
open(index.html) - The program opens the downloaded page
search(
) - Search the file until the first instance of ""
search(<img src) - Advance to "<img src"
get_comic() - Get the comic image location from current line
get_title(XKCD.title_text) - Get title text from current line
copy_to(~/Pictures/XKCD) - Copy the image to the archive
move_to(~/Desktop) - Move image and title text to the Desktop
The Original File
name(XKCD)
get_location(http://www.xkcd.com)
open(index.html)
search(<h1>)
search(<img src)
get_comic()
get_title(XKCD.title_text)
copy_to(~/Pictures/XKCD)
move_to(~/Desktop)
Pearls Before Swine Example
This downloads the comics Pearls Before Swine and moves it to the desktop. I will only explain commands that aren't in the xkcd example.
name(Pearls_Before_Swine) get_location(http://www.comics.com/comics/pearls/)
open(index.html)
search(<TD WIDTH="609")
print() - Prints the current line to the terminal
set_root(http://www.comics.com) - Sets the root of the comic image location to "http://www.comics.com". To determine if you need this, look at the source code from the page and find the line to display the comic. If the image source doesn't give the full address, the root location will need to be given (ROOT is usually the first part of the web address).
get_comic()
move_to(~/Desktop)
The Original File
name(Pearls_Before_Swine)
get_location(http://www.comics.com/comics/pearls/)
open(index.html)
search(<TD WIDTH="609")
print()
set_root(http://www.comics.com)
get_comic()
move_to(~/Desktop)