From 1c1d218c82e54d3a57fa9df854db141ef6e02aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Diedrich?= Date: Mon, 12 Aug 2024 11:48:36 +0200 Subject: [PATCH] Filter out ignored posts when parsing threads. Fixes #2 --- lib/something_erlang/awful_api/thread.ex | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/something_erlang/awful_api/thread.ex b/lib/something_erlang/awful_api/thread.ex index 1ca3d41..6be1818 100644 --- a/lib/something_erlang/awful_api/thread.ex +++ b/lib/something_erlang/awful_api/thread.ex @@ -12,7 +12,6 @@ defmodule SomethingErlang.AwfulApi.Thread do thread = Meeseeks.one(html, css("#thread")) - # Floki.find(html, "#thread") |> Floki.filter_out("table.post.ignored") thread_id = Meeseeks.attr(thread, "class") @@ -37,11 +36,11 @@ defmodule SomethingErlang.AwfulApi.Thread do end posts = - for post <- Meeseeks.all(thread, css("table.post")) do + for post <- Meeseeks.all(thread, css("table.post:not(.ignored)")) do %{ - userinfo: post |> userinfo(), - postdate: post |> postdate(), - postbody: post |> postbody() + userinfo: userinfo(post), + postdate: postdate(post), + postbody: postbody(post) } end