;;; sb-mainichi.el --- shimbun backend for MSN-Mainichi -*- coding: iso-2022-7bit; -*- ;; Copyright (C) 2001, 2002, 2003, 2004 Koichiro Ohba ;; Author: Koichiro Ohba ;; Katsumi Yamaoka ;; Keywords: news ;; 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: ;; Original code was sb-yomiuri.el which is written by ;; TSUCHIYA Masatoshi and ;; Yuuichi Teranishi ;;; Code: (require 'shimbun) (luna-define-class shimbun-mainichi (shimbun-japanese-newspaper shimbun) ()) (defvar shimbun-mainichi-top-level-domain "mainichi-msn.co.jp" "Name of the top level domain for the MSN-Mainichi INTERACTIVE.") (defvar shimbun-mainichi-url (concat "http://www." shimbun-mainichi-top-level-domain "/") "Name of the parent url.") (defvar shimbun-mainichi-group-table '(("shakai" "社会") ("shakai.edu" "教育") ("sports" "スポーツ") ("geinou" "芸能") ("kurashi" "暮らし") ("it" "IT") ("kagaku.science" "科学") ("kagaku.env" "環境") ("kagaku.medical" "医学") ("seiji" "政治") ("keizai" "経済") ("kokusai" "国際")) "List of supported groups and Japanese translations.") (defvar shimbun-mainichi-server-name "毎日新聞") (defvar shimbun-mainichi-from-address (concat "webmaster@" shimbun-mainichi-top-level-domain)) (defvar shimbun-mainichi-content-start "[\t\n ]*") (defvar shimbun-mainichi-content-end "\\([\t\n ]*<[^>]+>\\)*[\t\n ]*") (defvar shimbun-mainichi-x-face-alist '(("default" . "\ Face: iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAABGdBTUEAALGPC/xhBQAAABh QTFRFC2zfDGzfEnDgJn3iU5fnj7vvzuH4+vz++nlsOQAAAC90RVh0U29mdHdhcmUAWFYgVmVyc2l vbiAzLjEwYStGTG1hc2sgIFJldjogMTIvMjkvOTQbx6p8AAABA0lEQVR4nGWRPW+DMBiED5vuqK0 60yppVwQ0rFTYZo348poSA3uDzd/vCxNNT14en1/5zgZYEoCF69rk2zhWPR6GADwCl864tsaHFUJ dweTJuMcQZZ0kRQxkqnaHik2DbBwdVuPgtPG7WTcuhPdshdM5f7lp4SpyXUPoazu1i6HZpbY6R3a ZhAW8ztmZsDxPqf0Cb6zsVzQjJQA/2GNE2OWHbqaQvEggI7wFfOmxk1esLUL2GrJg2yBkrTSDqvB eJKmhqtNpttk3sllICskmdbXlGdkPNcd/TIuuvOxcM65IsxvSa2Q79w7V8AfL2u1nY9ZquuiWfK7 1BSVNQzxF9B+40y/ui1KdNxt0ugAAAAd0SU1FB9QEDQAjJMA7GTQAAAAASUVORK5CYII="))) (defvar shimbun-mainichi-expiration-days 7) (luna-define-method shimbun-groups ((shimbun shimbun-mainichi)) (mapcar 'car shimbun-mainichi-group-table)) (luna-define-method shimbun-current-group-name ((shimbun shimbun-mainichi)) (nth 1 (assoc (shimbun-current-group-internal shimbun) shimbun-mainichi-group-table))) (luna-define-method shimbun-index-url ((shimbun shimbun-mainichi)) (concat (shimbun-url-internal shimbun) (shimbun-subst-char-in-string ?. ?/ (shimbun-current-group-internal shimbun)) "/")) (defun shimbun-mainichi-make-date-string (&rest args) "Run `shimbun-make-date-string' with ARGS and fix a day if needed. \(shimbun-mainichi-make-date-string YEAR MONTH DAY &optional TIME TIMEZONE)" (save-match-data (let* ((ctime (current-time)) (date (apply 'shimbun-make-date-string args)) (time (shimbun-time-parse-string date)) (ms (car time)) (ls (cadr time)) (system-time-locale "C")) (if (or (> ms (car ctime)) (and (= ms (car ctime)) (> ls (cadr ctime)))) ;; It should be yesterday's same time. (progn (setq ms (1- ms)) (when (< (setq ls (- ls (eval-when-compile (- (* 60 60 24) 65536)))) 0) (setq ms (1- ms) ls (+ ls 65536))) (format-time-string "%a, %d %b %Y %R +0900" (list ms ls))) date)))) (defun shimbun-mainichi-get-headers (shimbun) (let* ((group (shimbun-current-group-internal shimbun)) (hierarchy (when (string-match "\\." group) (mapconcat 'identity (nreverse (split-string group "\\.")) "."))) (from (shimbun-from-address shimbun)) (case-fold-search t) url urls subgroup header topnews headers date) (while (search-forward "\r" nil t) (delete-backward-char 1)) (goto-char (point-min)) (while (re-search-forward "\