Skip to content

Commit

Permalink
Merge pull request #776 from freelawproject/fix-oklahoma
Browse files Browse the repository at this point in the history
fix(okla): Fix Oklahoma
  • Loading branch information
flooie authored Nov 19, 2023
2 parents 9a7a8b3 + 3b146ae commit 6e2033a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
3 changes: 2 additions & 1 deletion juriscraper/opinions/united_states/state/okla.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ def _process_html(self):

@staticmethod
def cleanup_content(content):
print(content)
tree = html.fromstring(content)
core_element = tree.xpath("//*[@id='oscn-content']")[0]
return html.tostring(
core_element, pretty_print=True, encoding="unicode"
)
).encode("utf-8")
29 changes: 21 additions & 8 deletions juriscraper/opinions/united_states/state/oklaag.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,27 @@
class Site(okla.Site):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
d = date.today()
self.url = "http://www.oscn.net/applications/oscn/Index.asp?ftdb=STOKAG&year={year}&level=1".format(
year=d.year
)
year = date.today().year
self.url = f"http://www.oscn.net/applications/oscn/Index.asp?ftdb=STOKAG&year={year}&level=1"
self.court_id = self.__module__

def _get_precedential_statuses(self):
return ["Unpublished"] * len(self.case_names)
self.status = "Unpublished"

def _process_html(self):
for row in self.html.xpath("//div/p['@class=document']")[::-1]:
if "OK" not in row.text_content():
continue
if "EMAIL" in row.text_content():
continue
citation, date, name = row.text_content().split(",", 2)
self.cases.append(
{
"date": date,
"name": name,
"docket": "",
"url": row.xpath(".//a")[0].get("href"),
"citation": citation,
}
)

@staticmethod
def cleanup_content(content):
Expand All @@ -39,4 +52,4 @@ def cleanup_content(content):
)[0]
return html.tostring(
core_element, pretty_print=True, encoding="unicode"
)
).encode("utf-8")

0 comments on commit 6e2033a

Please sign in to comment.