chatgpt-mirai-qq-bot-web-search 0.2.12__tar.gz → 0.2.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (16) hide show
  1. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/PKG-INFO +1 -1
  2. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/chatgpt_mirai_qq_bot_web_search.egg-info/PKG-INFO +1 -1
  3. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/setup.py +1 -1
  4. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/web_search/web_searcher.py +7 -16
  5. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/LICENSE +0 -0
  6. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/README.md +0 -0
  7. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/chatgpt_mirai_qq_bot_web_search.egg-info/SOURCES.txt +0 -0
  8. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/chatgpt_mirai_qq_bot_web_search.egg-info/dependency_links.txt +0 -0
  9. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/chatgpt_mirai_qq_bot_web_search.egg-info/entry_points.txt +0 -0
  10. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/chatgpt_mirai_qq_bot_web_search.egg-info/requires.txt +0 -0
  11. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/chatgpt_mirai_qq_bot_web_search.egg-info/top_level.txt +0 -0
  12. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/setup.cfg +0 -0
  13. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/web_search/__init__.py +0 -0
  14. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/web_search/blocks.py +0 -0
  15. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/web_search/config.py +0 -0
  16. {chatgpt-mirai-qq-bot-web-search-0.2.12 → chatgpt-mirai-qq-bot-web-search-0.2.13}/web_search/example/roleplayWithWebSearch.yaml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chatgpt-mirai-qq-bot-web-search
3
- Version: 0.2.12
3
+ Version: 0.2.13
4
4
  Summary: WebSearch adapter for lss233/chatgpt-mirai-qq-bot
5
5
  Home-page: https://github.com/chuanSir123/web_search
6
6
  Author: chuanSir
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chatgpt-mirai-qq-bot-web-search
3
- Version: 0.2.12
3
+ Version: 0.2.13
4
4
  Summary: WebSearch adapter for lss233/chatgpt-mirai-qq-bot
5
5
  Home-page: https://github.com/chuanSir123/web_search
6
6
  Author: chuanSir
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
  import io
3
3
  import os
4
4
 
5
- version = os.environ.get('RELEASE_VERSION', '0.2.12'
5
+ version = os.environ.get('RELEASE_VERSION', '0.2.13'
6
6
  '').lstrip('v')
7
7
 
8
8
  setup(
@@ -31,8 +31,8 @@ class WebSearcher:
31
31
  self.video_ids = self._load_video_ids()
32
32
  self.search_engines = {
33
33
  'bing': {
34
- 'url': 'https://cn.bing.com/search?q={}',
35
- 'selectors': ['.b_algo', '#b_results .b_algo', 'main .b_algo'],
34
+ 'url': 'https://www.bing.com/search?q={}',
35
+ 'selectors': ['.b_algo'],
36
36
  'title_selector': 'h2',
37
37
  'link_selector': 'h2 a',
38
38
  'snippet_selector': '.b_caption p'
@@ -260,7 +260,6 @@ class WebSearcher:
260
260
  wait_until='load',
261
261
  timeout=timeout * 1000
262
262
  )
263
-
264
263
  # 使用搜索引擎特定的选择器
265
264
  results = None
266
265
 
@@ -268,7 +267,7 @@ class WebSearcher:
268
267
  if engine == 'google':
269
268
  await self.simulate_human_scroll(page)
270
269
 
271
- selector_timeout = 5000
270
+ selector_timeout = timeout * 1000
272
271
  for selector in engine_config['selectors']:
273
272
  try:
274
273
  logger.info(f"Trying selector: {selector}")
@@ -297,7 +296,7 @@ class WebSearcher:
297
296
  await self.simulate_human_scroll(page)
298
297
 
299
298
  # 重新尝试所有选择器
300
- selector_timeout = 5000
299
+ selector_timeout = timeout * 1000
301
300
  for selector in engine_config['selectors']:
302
301
  try:
303
302
  logger.info(f"Retrying selector: {selector}")
@@ -342,12 +341,8 @@ class WebSearcher:
342
341
  logger.error(f"Search failed - Query: {query} - Error: {e}", exc_info=True)
343
342
  return f"搜索失败: {str(e)}"
344
343
  finally:
345
- if context:
346
- try:
347
- logger.debug("context.close")
348
- await context.close()
349
- except Exception as e:
350
- logger.error(f"Error closing page: {e}")
344
+ await self.close()
345
+
351
346
 
352
347
  async def close(self):
353
348
  """关闭浏览器"""
@@ -490,8 +485,4 @@ class WebSearcher:
490
485
  logger.error(f"抖音视频搜索失败 - 关键词: {keyword} - 错误: {e}", exc_info=True)
491
486
  return f"搜索失败: {str(e)}"
492
487
  finally:
493
- if context:
494
- try:
495
- await context.close()
496
- except Exception as e:
497
- logger.error(f"关闭页面错误: {e}")
488
+ await self.close()