DEV Community

Yoandy Rodriguez Martinez
Yoandy Rodriguez Martinez

Posted on • Originally published at yorodm.github.io on

2

Scraper para DEV desde Emacs

Scrapper para DEV desde Emacs.

Recién publiqué en DEV un artículo acerca de como hacer un scraper para obtener los títulos del feed principal. El artículo surgió de una discusión amistosa acerca de la relevancia de Common Lisp como tecnología en la actualidad y quedé muy satisfecho con el resultado.

Me llamó tanto la atención la simpleza detrás de las bibliotecas utilizadas que decidí ver si había una para Emacs Lisp y… TL;DR, aquí está el scrapper 😍.

;;; Eval this in the scratch buffer, first make sure to get
;;; `elquery' from MELPA.
;;; Eval this in a buffer and get the headlines in *another* buffer
;;; named *dev*
(require 'elquery)
(let ((dev-buffer (generate-new-buffer "*dev*")))
  (with-current-buffer (url-retrieve-synchronously "https://dev.to")
    ;; Feel free to hate this
    (dolist (elt (mapcar 'elquery-text (elquery-$ "div.single-article h3"
                                                  (elquery-read-string (buffer-string)))))
      (with-current-buffer dev-buffer (insert (concat elt "\n"))))))
Enter fullscreen mode Exit fullscreen mode

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (1)

Collapse
 
yorodm profile image
Yoandy Rodriguez Martinez

Gracias

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay