Skip to content

Commit

Permalink
Fix description formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ykerus committed Jan 19, 2024
1 parent bfc5c47 commit 1107656
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/crea_scraper/scraper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import logging
import os
import re
import time
from typing import Dict, List, Tuple

Expand Down Expand Up @@ -131,6 +132,12 @@ def _get_course_name(course_html) -> str:
def _get_course_description(course_html) -> str:
parts = [e.text for e in course_html.find(class_="wpb_wrapper").findChildren("p")]
description = "\n\n".join(parts)

description = re.sub(r"\.([a-zA-Z])", r". \1", description)
description = re.sub(r"\?([a-zA-Z])", r"? \1", description)
description = re.sub(r"\!([a-zA-Z])", r"! \1", description)
description = re.sub(r"([a-z])([A-Z])", r"\1, \2", description)

return description


Expand Down

0 comments on commit 1107656

Please sign in to comment.