;;;; -*- mode: lisp-interaction; syntax: elisp; coding: iso-2022-7bit -*- ;;; sb-cnn-jp.el --- shimbun backend for CNN Japan ;; Copyright (C) 2003 NAKAJIMA Mikio ;; Author: Tsuyoshi CHO ;; Keywords: news ;; Created: May 22, 2005 ;; This file is a part of shimbun. ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, you can either send email to this ;; program's maintainer or write to: The Free Software Foundation, ;; Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA. ;;; Commentary: ;;; Code: (require 'shimbun) (luna-define-class shimbun-cnn-jp (shimbun-japanese-newspaper shimbun) ()) (defvar shimbun-cnn-jp-top-level-domain "cnn.co.jp" "Name of the top level domain for the CNN Japan.") (defvar shimbun-cnn-jp-url (concat "http://www." shimbun-cnn-jp-top-level-domain "/") "Name of the parent url.") (defvar shimbun-cnn-jp-server-name "CNN Japan") (defvar shimbun-cnn-jp-from-address "webmaster@cnn.co.jp") (defvar shimbun-cnn-jp-content-start "Web posted at:") (defvar shimbun-cnn-jp-content-end "") (defvar shimbun-cnn-jp-expiration-days 14) (defvar shimbun-cnn-jp-group-alist `(("top" . ,shimbun-cnn-jp-url) ("world" . ,(concat shimbun-cnn-jp-url "world/world.html")) ("usa" . ,(concat shimbun-cnn-jp-url "usa/usa.html")) ("business" . ,(concat shimbun-cnn-jp-url "business/business.html")) ("sports" . ,(concat shimbun-cnn-jp-url "sports/sports.html")) ("science" . ,(concat shimbun-cnn-jp-url "science/science.html")) ("showbiz" . ,(concat shimbun-cnn-jp-url "showbiz/showbiz.html")) ("fringe" . ,(concat shimbun-cnn-jp-url "fringe/fringe.html")) )) (luna-define-method shimbun-groups ((shimbun shimbun-cnn-jp)) (mapcar 'car shimbun-cnn-jp-group-alist)) (luna-define-method shimbun-index-url ((shimbun shimbun-cnn-jp)) (cdr (assoc (shimbun-current-group-internal shimbun) shimbun-cnn-jp-group-alist))) (luna-define-method shimbun-get-headers ((shimbun shimbun-cnn-jp) &optional range) (with-temp-buffer (let ((url (shimbun-index-url shimbun)) (case-fold-search t) headers beg end) (shimbun-retrieve-url (shimbun-index-url shimbun)) (goto-char (point-min)) (re-search-forward "FULL STORY" nil t) (setq beg (point)) (re-search-forward "" nil t) (setq end (point)) (save-excursion (narrow-to-region beg end) (goto-char (point-min)) (let (title url date id str) (while (re-search-forward "\\([^<]*\\)" nil t) (setq title (match-string 2)) (setq str (substring (match-string 1) 1)) (setq url (shimbun-expand-url (concat shimbun-cnn-jp-url str))) (let (year month day) (string-match "\\([^/]*\\)/\\([^0-9]*\\)\\([0-9][0-9][0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9]*\\)" str) (setq year (match-string-no-properties 3 str) month (match-string-no-properties 4 str) day (match-string-no-properties 5 str)) (setq id (format "<%s%s%s%s%s%%%s@%s>" (match-string-no-properties 2 str) ; news provider year month day ; date (match-string-no-properties 6 str) ; number (match-string-no-properties 1 str) ; category shimbun-cnn-jp-top-level-domain)) ; domain (setq date (shimbun-make-date-string (string-to-int year) (string-to-int month) (string-to-int day))) (push (shimbun-create-header 0 title (shimbun-from-address shimbun) date id "" 0 0 url) headers))))) headers))) (provide 'sb-cnn-jp) ;;; sb-cnn-jp.el ends here