Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
md-arif-shaikh committed Jul 9, 2023
1 parent 65e9d4c commit 86bb9b2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions soccer-leagues.el
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@
"Get the base url of the website to get data from."
"https://www.theguardian.com/football/")

(defun soccer-leagues--get-base-league-url (league)
"Get the base url for a LEAGUE."
(if (member league (mapcar #'car soccer-leagues--leagues-alist))
(cdr (assoc league soccer-leagues--leagues-alist))
(user-error "Unknown league %s" league)))

(defun soccer-leagues--get-club-names-and-urls (league)
"Get the team names and the corresponding urls for a LEAGUE."
(let* ((url (concat (soccer-leagues--get-base-league-url league) "/table")))
Expand Down Expand Up @@ -98,6 +92,12 @@
:type '(alist :value-type (group integer))
:group 'soccer)

(defun soccer-leagues--get-base-league-url (league)
"Get the base url for a LEAGUE."
(if (member league (mapcar #'car soccer-leagues-leagues-alist))
(cdr (assoc league soccer-leagues-leagues-alist))
(user-error "Unknown league %s" league)))

(provide 'soccer-leagues)

;;; soccer-leagues.el ends here

2 comments on commit 86bb9b2

@CIAvash
Copy link
Contributor

@CIAvash CIAvash commented on 86bb9b2 Jul 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I hit this bug, I changed the soccer-leagues--get-competition-names-and-urls function to:

(defun soccer-leagues--get-competition-names-and-urls ()
  "Get the competition names and the corresponding urls."
  (let* ((url "https://www.theguardian.com/football/competitions"))
    (with-current-buffer (url-retrieve-synchronously url)
      (let* ((dom (libxml-parse-html-region (point-min) (point-max)))
	         (data-dom (dom-by-tag (dom-by-id dom "maincontent") 'li))
	         (url-list (cl-loop for d in data-dom
				                collect (cons (car (dom-strings d)) (concat "https://www.theguardian.com/" (dom-attr (dom-by-tag d 'a) 'href))))))
        url-list))))

and it works.

@md-arif-shaikh
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @CIAvash thanks for reporting this. Would you mind making a PR with this change?

Please sign in to comment.