Skip to content

Commit

Permalink
[scrap] Integrate the last commit #8aa00ca into current format. add f…
Browse files Browse the repository at this point in the history
…ew councils
  • Loading branch information
Re-st committed Nov 15, 2023
1 parent d6ce8d9 commit dd5764c
Show file tree
Hide file tree
Showing 47 changed files with 857 additions and 1,649 deletions.
3 changes: 0 additions & 3 deletions scrap/local_councils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
각 기초의회들의 크롤링 코드를 모아놓은 패키지입니다.
광역자치단체 별로 폴더를 만들어서 관리합니다.
"""
from .daejeon.daejeon import *
from .ulsan import *
from .daejeon import *
import re
from urllib.parse import urlparse
from typing import List
Expand Down
4 changes: 2 additions & 2 deletions scrap/local_councils/busan.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def scrap_36(url, cid, args: ArgsType = None) -> ScrapResult:
party = "정당 정보 없음"
party_info = name_tag.find_next("span", string="소속당 : ")
if party_info:
party = party_info.parent.get_text(strip=True)[7:].strip()
party = party_info.parent.get_text(strip=True)[6:].strip()

councilors.append(Councilor(name=name, jdName=party))

Expand Down Expand Up @@ -284,7 +284,7 @@ def scrap_38(url, cid, args: ArgsType = None) -> ScrapResult:
party = "정당 정보 없음"
party_info = profile.find("span", class_="bold", string="정당 : ")
if party_info:
party = party_info.parent.get_text(strip=True)[5:].strip()
party = party_info.parent.get_text(strip=True)[4:].strip()

councilors.append(Councilor(name=name, jdName=party))

Expand Down
2 changes: 1 addition & 1 deletion scrap/local_councils/daegu.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def scrap_46(url, cid, args: ArgsType = None) -> ScrapResult:
for profile in soup.find_all("div", class_="profile"):
name_tag = profile.find("em", class_="name")
name = (
name_tag.get_text(strip=True).split()[0].strip() if name_tag else "이름 정보 없음"
name_tag.get_text(strip=True).split()[0].replace('의원', '').strip() if name_tag else "이름 정보 없음"
)

party = "정당 정보 없음"
Expand Down
117 changes: 0 additions & 117 deletions scrap/local_councils/daejeon/daejeon.py

This file was deleted.

5 changes: 3 additions & 2 deletions scrap/local_councils/gangwon.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

from scrap.local_councils import *
from scrap.local_councils.basic import *
from scrap.utils.requests import get_selenium, By
from scrap.utils.utils import getPartyList
Expand Down Expand Up @@ -171,7 +172,7 @@ def scrap_118(

for profile in soup.find_all("div", class_="person_info"):
name_td = profile.find("th", string="성함/직위").find_next("td")
name = name_td.get_text(strip=True) if name_td else "이름 정보 없음"
name = name_td.get_text(strip=True).split()[0] if name_td else "이름 정보 없음"

party_td = profile.find("th", string="정당").find_next("td")
party = party_td.get_text(strip=True) if party_td else "정당 정보 없음"
Expand Down Expand Up @@ -290,7 +291,7 @@ def scrap_123(
for profile in soup.find_all("div", class_="img_text_box"):
name_li = profile.select_one("ul.bu li:contains('성명')")
name = (
name_li.get_text(strip=True).replace("성명", "").strip()
name_li.get_text(strip=True).replace("성명", "").strip().split()[0]
if name_li
else "이름 정보 없음"
)
Expand Down
Loading

0 comments on commit dd5764c

Please sign in to comment.