From 2906946ee9b79f0b3a8f5ce99d994cb85a8f082d Mon Sep 17 00:00:00 2001
From: Mint <>
Date: Fri, 2 Sep 2022 22:01:39 +0300
Subject: [PATCH] More logical Mastodon parsing order (fixes parsing pages with
lots of
)
---
fetch_blocks.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fetch_blocks.py b/fetch_blocks.py
index e2b5a38..50071b4 100644
--- a/fetch_blocks.py
+++ b/fetch_blocks.py
@@ -39,11 +39,11 @@ def get_mastodon_blocks(domain: str) -> dict:
return {}
for header in doc.find_all("h3"):
- for line in header.find_next_siblings("table")[0].find_all("tr")[1:]:
- header_text = header.text
- if header_text in translations:
- header_text = translations[header_text]
- if header_text in blocks:
+ header_text = header.text
+ if header_text in translations:
+ header_text = translations[header_text]
+ if header_text in blocks:
+ for line in header.find_next_siblings("table")[0].find_all("tr")[1:]:
blocks[header_text].append(
{
"domain": line.find("span").text,
--
2.39.5