From 8481681c9b2f3bd1ddab12a657f5f3827e288ad7 Mon Sep 17 00:00:00 2001 From: Thanh Vuong Date: Tue, 27 Sep 2022 22:23:19 -0600 Subject: adapt to css change --- hnreader.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hnreader.el b/hnreader.el index a2b7fef..f576c7b 100644 --- a/hnreader.el +++ b/hnreader.el @@ -5,7 +5,7 @@ ;; Author: Thanh Vuong ;; URL: https://github.com/thanhvg/emacs-hnreader/ ;; Package-Requires: ((emacs "25.1") (promise "1.1") (request "0.3.0") (org "9.2")) -;; Version: 0.2.1 +;; Version: 0.2.2 ;; 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 @@ -46,6 +46,7 @@ ;; when viewing comments ;;; Changelog +;; 0.2.2 2022-09-27 update css class grab for entry title ;; 0.2.1 2021-10-18 update css class grab for entry title ;;; Code: @@ -157,13 +158,14 @@ third one is 80.") (defun hnreader--print-frontpage-item (thing subtext) "Print THING dom and SUBTEXT dom." - (let ((url (format "https://news.ycombinator.com/item?id=%s" (dom-attr thing 'id))) - (title-link (dom-attr (dom-by-class thing "^titlelink$") 'href))) + (let* ((url (format "https://news.ycombinator.com/item?id=%s" (dom-attr thing 'id))) + (a-node (dom-child-by-tag (dom-by-class thing "^titleline$") 'a)) + (title-link (dom-attr a-node 'href))) (insert (format "\n* %s %s (%s) [%s]\n" ;; rank (dom-text (dom-by-class thing "^rank$")) ;; title - (dom-text (dom-by-class thing "^titlelink$")) + (dom-text a-node) ;; points (dom-text (dom-by-class subtext "^score$")) ;; comments @@ -243,7 +245,7 @@ third one is 80.") (defun hnreader--get-title (dom) "Get title and link from DOM comment page." - (let ((a-link (dom-by-class dom "^titlelink$"))) + (let ((a-link (dom-child-by-tag (dom-by-class dom "^titleline$") 'a))) (cons (dom-text a-link) (dom-attr a-link 'href)))) (defun hnreader--get-post-info (dom) -- cgit v1.2.3