이미지 크롤링 로직 변경 및 자막 이미지 매칭 보완
This commit is contained in:
1 parent
04d8614919
commit
46449a7a3f
20 files changed
+1828
-1116
No files matched your search
@@ -52,14 +52,12 @@ class NvMapPwScraper():
|
||||
cls.is_ready = True
|
||||
|
||||
GRAPHQL_URL = "https://pcmap-api.place.naver.com/graphql"
|
||||
_PLACE_TYPES = ("restaurant", "accommodation")
|
||||
|
||||
@classmethod
|
||||
async def fetch_graphql(
|
||||
cls,
|
||||
place_id: str,
|
||||
payloads: list[dict],
|
||||
place_type: str | None = None,
|
||||
) -> list[dict | None] | None:
|
||||
"""실제 브라우저로 네이버 WTM 안티봇 캡차를 통과해 GraphQL 쿼리를 실행한다.
|
||||
|
||||
@@ -73,8 +71,6 @@ class NvMapPwScraper():
|
||||
Args:
|
||||
place_id: 네이버 place ID
|
||||
payloads: GraphQL POST 본문 목록
|
||||
place_type: "restaurant" | "accommodation" (없으면 둘 다 시도)
|
||||
|
||||
Returns:
|
||||
payload별 파싱 JSON 목록(실패 항목은 None). 토큰 캡처 실패 시 None.
|
||||
"""
|
||||
@@ -95,8 +91,7 @@ class NvMapPwScraper():
|
||||
page.on("request", on_request)
|
||||
|
||||
try:
|
||||
types = [place_type] if place_type in cls._PLACE_TYPES else list(cls._PLACE_TYPES)
|
||||
for t in types:
|
||||
for t in ("place", "restaurant", "accommodation"):
|
||||
try:
|
||||
await page.goto(
|
||||
f"https://pcmap.place.naver.com/{t}/{place_id}/home",
|
||||
|
||||
Reference in new issue
Block a user