Skip to content

Commit

Permalink
Merge pull request #17 from blacknon/develop
Browse files Browse the repository at this point in the history
update. v1.1.5
  • Loading branch information
blacknon committed Jul 27, 2023
2 parents 8e327f1 + 6272191 commit 3ee7cd1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pydork/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

# メッセージ出力(コマンド実行時のみ)
Expand Down
29 changes: 24 additions & 5 deletions pydork/engine_bing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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を指定
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 3ee7cd1

Please sign in to comment.