diff --git a/pydork/engine.py b/pydork/engine.py index 2f1e68d..635adbf 100644 --- a/pydork/engine.py +++ b/pydork/engine.py @@ -335,7 +335,7 @@ def search(self, keyword: str, search_type='text', maximum=100): # ENGINEへMessage()を渡す self.ENGINE.set_messages(self.MESSAGE) - if self.ENGINE.LANG != "" or self.ENGINE.LOCALE != "": + if self.ENGINE.LANG == "" and self.ENGINE.LOCALE == "": self.set_lang() # メッセージ出力(コマンド実行時のみ) diff --git a/pydork/engine_bing.py b/pydork/engine_bing.py index c9534bd..797a728 100644 --- a/pydork/engine_bing.py +++ b/pydork/engine_bing.py @@ -58,6 +58,21 @@ def gen_search_url(self, keyword: str, type: str): search_url = '' + # NOTE: + # 2023/07/27にて、queryが以下のように切り替わったため修正 + # - `https://www.bing.com/search?q=site%3aorebibou.com&search=%e9%80%81%e4%bf%a1&rdr=1&rdrig=D4B6730A85514F25BAE1E9BDC04F1C28&cc=us&setlang=en` + # ```json + # { + # 'q': ['site:orebibou.com'], + # 'search': ['送信'], + # 'rdr': ['1'], + # 'rdrig': ['D4B6730A85514F25BAE1E9BDC04F1C28'], + # 'cc': ['us'], + # 'setlang': ['en'] + # } + # ``` + # - `https://www.bing.com/search?q=site%3aorebibou.com&search=%E9%80%81%E4%BF%A1&rdr=1&rdrig=D4B6730A85514F25BAE1E9BDC04F1C28&cc=us&setlang=en&FPIG=B035C5DE50AE4A328CB93C767B02D08B&first=11&FORM=PERE&count=100` + # 検索タイプがtextの場合 if type == 'text': # 検索urlを指定 @@ -67,16 +82,20 @@ def gen_search_url(self, keyword: str, type: str): url_param = { 'q': keyword, # 検索キーワード 'count': '100', # 1ページごとの表示件数 - 'go': '検索', - 'qs': 'ds', - 'from': 'QBRE', + 'search': '送信', + 'rdr': '1', + 'from': 'PERE', + 'cc': 'us', + 'setlang': 'en', 'filters': '', # 期間含めフィルターとして指定するパラメータ 'first': '' # 開始位置 } # lang/localeが設定されている場合 - if self.LANG != '' and self.LOCALE != '': - url_param['mkt'] = self.LANG + '-' + self.LOCALE + if self.LANG != '': + url_param['setlang'] = self.LANG.lower() + if self.LOCALE != '': + url_param['cc'] = self.LOCALE.lower() # rangeが設定されている場合 try: diff --git a/setup.py b/setup.py index d2e1d89..59c15c8 100755 --- a/setup.py +++ b/setup.py @@ -82,8 +82,8 @@ def get_completefile_install_location(shell): name = 'pydork' -version = '1.1.4' -release = '1.1.4' +version = '1.1.5' +release = '1.1.5' if __name__ == "__main__": setuptools.setup(