Fork me on GitHub
#pathom
<
2022-07-05
>
Athan07:07:40

Hi, I worked a bit with your Hacker News Scraper. The https://pathom3.wsscode.com/docs/tutorials/hacker-news-scraper#read-item-details function will fail to parse item/title and item/url. Apparently Hacker News changed class name from "storylink" to "titlelink". Modify the code as follows:

(defn extract-item-from-hickory [el]
	{:hacker-news.item/age            (class-text el "age")
	 :hacker-news.item/author-name    (class-text el "hnuser")
	 :hacker-news.item/comments-count (->> (hs/select (hs/find-in-text #"comments$") el)
																				 first
																				 (find-text)
																				 (select-number))
	 :hacker-news.item/score          (select-number (class-text el "score"))
	 :hacker-news.item/id             (->> el :content first :attrs :id)
	 :hacker-news.item/rank-in-page   (select-number (class-text el "rank"))
	 :hacker-news.item/source         (class-text el "sitestr")

	 :hacker-news.item/title          (class-text el "titlelink")
	 :hacker-news.item/url            (->> (hs/select (hs/class "titlelink") el)
																				 first :attrs :href)
	 })

wilkerlucio11:07:45

thanks! can you send a PR with the changes? there is an Edit this page button at the end of every page in the docs 🙂