Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separate proposers and supporters #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions bills/specific/html2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,15 @@ def extract_summaries(assembly_id, bill_id):
except IOError as e:
return None

def extract_proposers(assembly_id, bill_id):
def extract_proposers_or_supporters(assembly_id, bill_id, is_proposers):
#TODO: 찬성의원 목록에 의원 이름이 있는 경우가 있는자 확인
fn = '%s/%s/%s.html' % (DIR['proposers'], assembly_id, bill_id)
page = utils.read_webpage(fn)
elems = utils.get_elems(page, X['proposers'])

# There are 2 3-depth table in this page. 1st: proposer, 2nd: supporters
depth_three_tables = page.xpath('//table//table//table')

elems = depth_three_tables[0 if is_proposers else 1].xpath(X['proposers'])
if assembly_id < 19:
return elems
else:
Expand All @@ -234,7 +238,8 @@ def parse_page(assembly_id, bill_id, meta, directory):
fn = '%s/%s.json' % (directory, bill_id)

d = extract_specifics(assembly_id, bill_id, meta)
d['proposers'] = extract_proposers(assembly_id, bill_id)
d['proposers'] = extract_proposers_or_supporters(assembly_id, bill_id, true)
d['supporters'] = extract_proposers_or_supporters(assembly_id, bill_id, false)
d['summaries'] = extract_summaries(assembly_id, bill_id)
d['withdrawers'] = extract_withdrawers(assembly_id, bill_id)
d['proposed_date'] = include(meta, bill_id, 'proposed_date')
Expand Down