네이버 검색 API 를 SearXNG 엔진으로 붙인다 - #33
Merged
Merged
Conversation
스크래핑 `naver` 엔진은 이 네트워크에서 막혀 있다. 대신 Open API 를 json_engine 두 개(`naver web` 일반, `naver news` 뉴스)로 정의한다. 한국 사용자가 찾는 곳을 원본에서 받고, 무료 한도는 애플리케이션당 하루 25,000건, 검색 한 번에 엔진마다 1건이다. `gen-searxng-config.sh` 가 `.env` 의 NAVER_CLIENT_ID / NAVER_CLIENT_SECRET 을 헤더에 넣고, 둘 다 있을 때만 `disabled: false` 로 쓴다. 없으면 「unset」과 `disabled: true` 로 써서 호출이 나가지 않는다. `.env.example` 과 docs/tools.md 에 발급·적용 절차를 적었다. 확인: 임시 SearXNG 컨테이너에 더미 키로 켜서 /config 에 두 엔진이 실리고 질의가 openapi.naver.com 에 닿는 것(401)을 봤다. 키 없는 운영 설정은 두 엔진이 꺼진 채 생성된다.
developers.naver.com의 검색 API가 NAVER API HUB(naverapihub.apigw.ntruss.com)로
이전되어 경로와 인증 헤더가 바뀌었다. naver web·naver news 두 json_engine의
search_url을 /search/v1/{webkr,news}로, 헤더를 X-NCP-APIGW-API-KEY-ID /
X-NCP-APIGW-API-KEY로 바꾸고, 설정 주석·docs/tools.md·.env.example의 한도
(월 775,000건 합산, 키당 50 RPS)와 발급처를 현 상태에 맞춘다.
확인: 운영 SearXNG에서 config 재생성·재시작 후 naver web이 「분당 날씨」
「국민연금 수령액 인상」에 nps.or.kr·weather.naver.com 결과를 돌려주고 일반
레인에서 yandex보다 앞에 선다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경
services/searxng/settings.yml.example:naver web(general)·naver news(news)를 SearXNG의 json_engine으로 정의. 헤더의 자격 증명과disabled는 센티널.scripts/gen-searxng-config.sh:.env의NAVER_CLIENT_ID/NAVER_CLIENT_SECRET을 주입하고, 둘 다 있을 때만 켠다. 없으면 「unset」·disabled: true..env.example·docs/tools.md: 발급(developers.naver.com → 애플리케이션 등록 → 검색 API)과 적용 절차, 한도(하루 25,000건), 약관 메모.확인
/config에 두 엔진이 실리고 질의가openapi.naver.com에 닿는 것(401 Unauthorized)을 확인..env에 넣고./scripts/gen-searxng-config.sh→docker compose restart searxng.KloudChat 쪽에 앞서 넣었던 앱 레인은 걷어 냈다(KloudChat #177). 검색 경로는 SearXNG 하나다.