1;;; sb-atmarkit.el --- shimbun backend for atmarkit 2 3;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010 4;; NAKAJIMA Mikio <minakaji@namazu.org> 5 6;; Author: NAKAJIMA Mikio <minakaji@namazu.org> 7;; Keywords: news 8;; Created: Jun 15, 2003 9 10;; This file is a part of shimbun. 11 12;; This program is free software; you can redistribute it and/or modify 13;; it under the terms of the GNU General Public License as published by 14;; the Free Software Foundation; either version 2, or (at your option) 15;; any later version. 16 17;; This program is distributed in the hope that it will be useful, 18;; but WITHOUT ANY WARRANTY; without even the implied warranty of 19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20;; GNU General Public License for more details. 21 22;; You should have received a copy of the GNU General Public License 23;; along with this program; see the file COPYING. If not, write to 24;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 25;; Boston, MA 02110-1301, USA. 26 27;;; Commentary: 28 29;;; Code: 30 31(require 'shimbun) 32(require 'sb-rss) 33(require 'sb-multi) 34 35(luna-define-class shimbun-atmarkit (shimbun-multi shimbun-rss) ()) 36 37(defvar shimbun-atmarkit-coding-system 'euc-japan) 38(defvar shimbun-atmarkit-content-start "<body[^>]*>") 39(defvar shimbun-atmarkit-content-end "</body[^>]*>") 40 41(defvar shimbun-atmarkit-group-path-alist 42 '( ;; ニュース系 43 ;; NewsInsight 44 ("news". "http://www.atmarkit.co.jp/rss/news/rss2dc.xml") 45 ;; フォーラム系 46 ;; Windows Server Insiderフォーラム 47 ("fwin2k" . "http://www.atmarkit.co.jp/rss/fwin2k/rss2dc.xml") 48 ;; Insider.NETフォーラム 49 ("fdotnet" . "http://www.atmarkit.co.jp/rss/fdotnet/rss2dc.xml") 50 ;; System Insiderフォーラム 51 ("fsys" . "http://www.atmarkit.co.jp/rss/fsys/rss2dc.xml") 52 ;; XML & Web Servicesフォーラム 53 ("fxml" . "http://www.atmarkit.co.jp/rss/fxml/rss2dc.xml") 54 ;; Database Expertフォーラム 55 ("fdb". "http://www.atmarkit.co.jp/rss/fdb/rss2dc.xml") 56 ;; Linux Squareフォーラム 57 ("flinux" . "http://www.atmarkit.co.jp/rss/flinux/rss2dc.xml") 58 ;; Master of IP Networkフォーラム 59 ("fnetwork" . "http://www.atmarkit.co.jp/rss/fnetwork/rss2dc.xml") 60 ;; Java Solutionフォーラム 61 ("fjava" . "http://www.atmarkit.co.jp/rss/fjava/rss2dc.xml") 62 ;; Security&Trustフォーラム 63 ("fsecurity". "http://www.atmarkit.co.jp/rss/fsecurity/rss2dc.xml") 64 ;; Web Client & Reportフォーラム 65 ("fwcr" . "http://www.atmarkit.co.jp/rss/fwcr/rss2dc.xml") 66 ;; IT Architectフォーラム 67 ("farc" . "http://www.atmarkit.co.jp/rss/farc/rss2dc.xml") 68 69 ;; obsolete フォーラム系 70 ;; Business Computingフォーラム 71 ("fbiz" . "http://www.atmarkit.co.jp/rss/fbiz/rss2dc.xml") 72 ;; @IT自分戦略研究所 73 ("jibun" . "http://jibun.atmarkit.co.jp/rss/rss2dc.xml") 74 )) 75 76(luna-define-method shimbun-groups ((shimbun shimbun-atmarkit)) 77 (mapcar 'car shimbun-atmarkit-group-path-alist)) 78 79(luna-define-method shimbun-index-url ((shimbun shimbun-atmarkit)) 80 (cdr (assoc (shimbun-current-group-internal shimbun) 81 shimbun-atmarkit-group-path-alist))) 82 83(luna-define-method shimbun-article-url ((shimbun shimbun-atmarkit) 84 header) 85 "http://www.atmarkit.co.jp/club/print/print.php") 86 87(luna-define-method shimbun-get-headers :around ((shimbun shimbun-atmarkit) 88 &optional range) 89 (mapcar 90 (lambda (header) 91 (shimbun-header-set-xref header 92 (shimbun-real-url (shimbun-header-xref header))) 93 header) 94 (luna-call-next-method))) 95 96(luna-define-method shimbun-multi-next-url ((shimbun shimbun-atmarkit) 97 header url) 98 (goto-char (point-max)) 99 (when (re-search-backward 100 "<a href=\"\\([^\"]+\\)\"><img src=\"[^\"]*/images/next\\.gif\"" nil t) 101 (shimbun-expand-url (match-string 1) url))) 102 103(luna-define-method shimbun-multi-clear-contents ((shimbun shimbun-atmarkit) 104 header 105 has-previous-page 106 has-next-page) 107 (when (shimbun-clear-contents shimbun header) 108 (when has-next-page 109 ;; Remove footer. 110 (goto-char (point-min)) 111 (when (re-search-forward 112 "<img src=\"[^\"]*/images/\\(prev\\|next\\)\\.gif\"" nil t) 113 (delete-region (line-beginning-position) (point-max)) 114 (insert "</tr></table>"))) 115 t)) 116 117(luna-define-method shimbun-clear-contents :before ((shimbun shimbun-atmarkit) 118 header) 119 (shimbun-remove-tags "script\\|noscript\\|form" t)) 120 121(luna-define-method shimbun-article :before ((shimbun shimbun-atmarkit) 122 header &optional outbuf) 123 (let ((xref (shimbun-header-xref header)) 124 end) 125 (when (setq end (string-match "\\?" xref)) 126 (setq xref (substring xref 0 end))) 127 (shimbun-header-set-xref header xref))) 128 129(provide 'sb-atmarkit) 130 131;;; sb-atmarkit.el ends here 132