utility class added

자료 저장 구조 고민중...
This commit is contained in:
2024-04-08 01:33:15 +09:00
parent 809748a73a
commit cc02151899
6 changed files with 217 additions and 61 deletions

View File

@@ -5,13 +5,17 @@ from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from bs4 import BeautifulSoup
import UtilPack as util
listResult = []
#
def GetSearchResult(searchWord):
print("E-hentai start")
#url = getSiteUrl() + searchWord
url = "https://e-hentai.org/"
url = getSiteUrl(searchWord)
util.DbgOut("EHentai : " + url)
driver = webdriver.Chrome()
driver.get(url)
@@ -21,7 +25,7 @@ def GetSearchResult(searchWord):
EC.presence_of_element_located((By.CLASS_NAME, 'dp'))
)
except TimeoutException:
print("페이지가 로드되지 않았거나 요소를 찾을 수 없습니다.")
util.DbgOut("페이지가 로드되지 않았거나 요소를 찾을 수 없습니다.")
driver.quit()
return
@@ -33,8 +37,10 @@ def GetSearchResult(searchWord):
pass
#
def getSiteUrl():
strRet = "https://e-hentai.org/?f_search="
def getSiteUrl(searchWord):
strRet = "https://e-hentai.org/"
if False == util.IsEmptyStr(searchWord):
strRet = strRet + "?f_search=" + searchWord
return strRet
@@ -46,7 +52,6 @@ def parseMangaInfos(html_doc):
gallery_table = soup.find('table', class_='itg gltc')
gls = gallery_table.find_all('tr')
idx = 1;
for gl in gls:
gl1cParse(gl)
gl2cParse(gl)
@@ -106,10 +111,5 @@ def gl3cParse(soup_element):
print(" " + man_tag)
man_tags.append(man_tag)
print(len(man_tags))
pass