From 8e934616e0fadc215b4620f26a86b8e54f767b1b Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Fri, 3 Jun 2016 16:47:13 +0700 Subject: [PATCH] Readme update --- README.md | 8 ++++++++ parser.rb | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 917dc2a..6f05338 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,11 @@ IFDB stands for Interactive Fiction DataBase. You can visit the site here: http://ifdb.tads.org/ + +The script has three options you can edit. +They are placed in the beginning of the file: + +* `ifdb_url` - sets the search URL. By default it's set to "All Games", sorted + by release date. +* `ifdb_start_page` - starting page, default 1 +* `ifdb_get_pages` - how many pages you want to get, default 1 diff --git a/parser.rb b/parser.rb index 35d54c2..09a81ce 100644 --- a/parser.rb +++ b/parser.rb @@ -4,6 +4,14 @@ require 'sqlite3' require 'data_mapper' require 'dm-migrations' +### CUSTOMIZE THESE ### + +ifdb_url = "http://ifdb.tads.org/search?searchfor=&sortby=&browse&pg=" +ifdb_start_page = 1 +ifdb_get_pages = 1 + +### THE CODE FOLLOWS + DataMapper.setup(:default, 'sqlite://'+`pwd`.chomp()+'/ifdb.sqlite3') class Work @@ -85,9 +93,6 @@ def page_parsing(url) end end -ifdb_url = "http://ifdb.tads.org/search?searchfor=&sortby=&browse&pg=" -ifdb_start_page = 1 -ifdb_get_pages = 1 current_page = ifdb_start_page while current_page <= ifdb_get_pages do url = ifdb_url + current_page.to_s