Skip to content

Commit

Permalink
Change html parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Coder-Iro committed Apr 6, 2023
1 parent 7a48392 commit b160eba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
19 changes: 9 additions & 10 deletions comcigan/async_school.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
from typing import List, Tuple

from base64 import b64encode
from json import loads
from typing import List, Tuple

from aiohttp import ClientSession
from bs4 import BeautifulSoup

from .reg import (
routereg,
prefixreg,
orgdatareg,
daydatareg,
thnamereg,
sbnamereg,
regsearch,
extractint,
orgdatareg,
prefixreg,
regsearch,
routereg,
sbnamereg,
thnamereg,
)


async def AsyncRequest(url: str, encoding: str = None):
async def AsyncRequest(url: str, encoding: str | None = None):
async with ClientSession() as sess:
async with sess.get(url) as res:
return await res.text(encoding)
Expand All @@ -39,7 +38,7 @@ class CONSTANT:
async def refresh(self):
comci_resp = await AsyncRequest(f"{URL}/st")

comcigan_html = BeautifulSoup(comci_resp, "html.parser")
comcigan_html = BeautifulSoup(comci_resp, "lxml")
script = comcigan_html.find_all("script")[1].contents[0]

route = regsearch(routereg, script)
Expand Down
2 changes: 1 addition & 1 deletion comcigan/school.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def trim(lis):
comci_resp = get(f"{URL}/st")
comci_resp.encoding = "EUC-KR"

comcigan_html = BeautifulSoup(comci_resp.text, "html.parser")
comcigan_html = BeautifulSoup(comci_resp.text, "lxml")
script = comcigan_html.find_all("script")[1].contents[0]

route = regsearch(routereg, script)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
setup(
name="comcigan",
version=version,
author="Team IF",
author_email="Coder-Iro@teamif.io",
author="Coder-Iro",
author_email="doohee006@gmail.com",
description="Unofficial Comcigan API python wrapper",
long_description=open("README.md", "r", encoding="UTF-8").read(),
long_description_content_type="text/markdown",
Expand Down

0 comments on commit b160eba

Please sign in to comment.