Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blocket_api/ad_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _extract_price(self, grid: Tag, data: dict) -> None:
data["price"] = price_elem.get_text(strip=True)

def _extract_description(self, grid: Tag, data: dict) -> None:
for section in grid.find_all("section", class_="border-t mt-40 pt-40"):
for section in grid.find_all("section", class_="pt-40 border-t mt-40"):
h2 = section.find("h2", class_="t3 mb-0")
if h2 and "beskrivning" in h2.get_text(strip=True).lower():
desc_div = section.find("div", class_="whitespace-pre-wrap")
Expand Down
4 changes: 2 additions & 2 deletions tests/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def test_get_ad_car(self) -> None:
<span class="t2">389 000 kr</span>
</div>

<section class="border-t mt-40 pt-40">
<section class="pt-40 border-t mt-40">
<h2 class="t3 mb-0">Beskrivning</h2>
<div class="whitespace-pre-wrap">Mycket fin bil i nyskick.</div>
</section>
Expand Down Expand Up @@ -311,7 +311,7 @@ def test_get_mc_ad(self) -> None:
<span class="t2">110 000 kr</span>
</div>

<section class="border-t mt-40 pt-40">
<section class="pt-40 border-t mt-40">
<h2 class="t3 mb-0">Beskrivning</h2>
<div class="whitespace-pre-wrap">Snabb båge</div>
</section>
Expand Down
Loading