=head1 NAME kleingebaeck - kleinanzeigen.de backup tool =head1 SYNOPSYS Usage: kleingebaeck [-dvVhmoc] [,...] Options: -u --user Backup ads from user with uid . -d --debug Enable debug output. -v --verbose Enable verbose output. -o --outdir Set output dir (default: current directory) -l --limit Limit the ads to download to , default: load all. -c --config Use config file (default: ~/.kleingebaeck). --ignoreerrors Ignore HTTP errors, may lead to incomplete ad backup. -f --force Overwrite images and ads even if the already exist. -m --manual Show manual. -h --help Show usage. -V --version Show program version. =head1 DESCRIPTION This tool can be used to backup ads on the german ad page L. It downloads all (or only the specified ones) ads of one user into a directory, each ad into its own subdirectory. The backup will contain a textfile B which contains the ad contents such as title, body, price etc. All images will be downloaded as well. =head1 CONFIGURATION You can create a config file to save typing. By default C<~/.kleingebaeck> is being used but you can specify one with C<-c> as well. We use TOML as our configuration language. See L. Format is pretty simple: user = 1010101 loglevel = verbose outdir = "test" useragent = "Mozilla/5.0" template = """ Title: {{.Title}} Price: {{.Price}} Id: {{.ID}} Category: {{.Category}} Condition: {{.Condition}} Type: {{.Type}} Color: {{.Color}} Created: {{.Created}} {{.Text}} """ Be careful if you want to change the template. The variable is a multiline string surrounded by three double quotes. You can left out certain fields and use any formatting you like. Refer to L for details how to write a template. Also read the TEMPLATES section below. If you're on windows and want to customize the output directory, put it into single quotes to avoid the backslashes interpreted as escape chars like this: outdir = 'C:\Data\Ads' =head1 TEMPLATES Various parts of the configuration can be modified using templates: the output directory, the ad directory and the ad listing itself. =head2 OUTPUT DIR TEMPLATE The config varialbe C or the command line parameter C<-o> take a template which may contain: =over =item C<{{.Year}}> =item C<{{.Month}}> =item C<{{.Day}}> =back That way you can create a new output directory for every backup run. For example: outdir = "/home/backups/ads-{{.Year}}-{{.Month}}-{{.Day}}" Or using the command line flag: -o "/home/backups/ads-{{.Year}}-{{.Month}}-{{.Day}}" The default value is C<.> - the current directory. =head2 AD DIRECTORY TEMPLATE The ad directory name can be modified using the following ad values: =over =item {{.Price}} =item {{.ID}} =item {{.Category}} =item {{.Condition}} =item {{.Created}} =item {{.Slug}} =item {{.Text}} =back It can only be configured in the config file. By default only C<{{.Slug}}> is being used, this is the title of the ad in url format. =head2 AD TEMPLATE The ad listing itself can be modified as well, using the same variables as the ad name template above. This is the default template: Title: {{.Title}} Price: {{.Price}} Id: {{.ID}} Category: {{.Category}} Condition: {{.Condition}} Type: {{.Type}} Created: {{.Created}} Expire: {{.Expire}} {{.Text}} The config parameter to modify is C