rbelando / e-portem-downloader

Tool that allows you to download all your documents in e-portem portal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document title and type use the same locator

javiercoll opened this issue · comments

Document title and type have the same locator

<div class="col-md-2">

Which causes this error:
image

I did an ugly and fast workaround, which is after finding the title, search for the type after it:

...
doc_date = response_text[start_date_index:end_index_date]
# Getting document description
end_index_description_pattern = response_text[end_index_date:].find(
    DOC_TYPE_PATTERN) + len(DOC_TYPE_PATTERN)
start_description_index = end_index_description_pattern + end_index_date
closing_div_index = response_text[start_description_index:].find(
    '</div>')
end_index_description = start_description_index + closing_div_index
description = response_text[start_description_index:end_index_description]
# Getting document type
end_index_doc_type_pattern = response_text[end_index_description:].find(
    DOC_TYPE_PATTERN) + len(DOC_TYPE_PATTERN)
start_doc_type_index = end_index_doc_type_pattern + end_index_description
closing_div_index = response_text[start_doc_type_index:].find(
    '</div>')
end_index_doc_type = start_doc_type_index + closing_div_index
doc_type = response_text[start_doc_type_index:end_index_doc_type]
...

Hope this helps, very nice work dude 👌