Jarvis-Brain 0.1.7.1__tar.gz → 0.1.7.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Jarvis_Brain
3
- Version: 0.1.7.1
3
+ Version: 0.1.7.2
4
4
  Summary: Jarvis brain mcp
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: beautifulsoup4
@@ -42,7 +42,7 @@ def register_get_html(mcp: FastMCP, browser_manager, client_manager: DPProxyClie
42
42
  async def get_html(browser_port: int, tab_id: str) -> dict[str, Any]:
43
43
  _browser = browser_manager.get_browser(browser_port)
44
44
  tab = _browser.get_tab(tab_id)
45
- file_name_prefix = str(tab.title).replace("/", "_").replace(":", "_")
45
+ file_name_prefix = hashlib.md5(str(tab.title).encode('utf-8')).hexdigest()
46
46
  if not os.path.exists(html_source_code_local_save_path):
47
47
  os.makedirs(html_source_code_local_save_path)
48
48
  min_html, compress_rate = compress_html(tab.html)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "Jarvis_Brain" # 别人下载时用的名字,必须在 PyPI 上唯一
3
- version = "0.1.7.1"
3
+ version = "0.1.7.2"
4
4
  description = "Jarvis brain mcp"
5
5
  dependencies = [
6
6
  "fastmcp",
@@ -1,6 +1,6 @@
1
1
  import threading
2
2
  from collections import deque
3
-
3
+ import time
4
4
  from DrissionPage import ChromiumPage, ChromiumOptions
5
5
  from DrissionPage._pages.chromium_tab import ChromiumTab
6
6
  from DrissionPage._units.listener import DataPacket
@@ -133,31 +133,31 @@ def check_data_packet(packet: DataPacket, client: DPProxyClient):
133
133
  data = None
134
134
  if packet.request.hasPostData:
135
135
  data = packet.request.postData
136
+ body = packet.response.body
136
137
  temp_dict = {
137
138
  "url": url,
138
139
  "method": method,
139
140
  "request_data": data,
140
- "request_headers": packet.request.headers,
141
- "response_headers": packet.response.headers,
142
- "response_body": packet.response.body,
141
+ "request_headers": dict(packet.request.headers),
142
+ "response_headers": dict(packet.response.headers),
143
+ "response_body": body,
143
144
  }
144
- print(temp_dict)
145
+ # print(temp_dict)
145
146
  client.packet_queue.append(temp_dict)
146
147
 
147
148
 
148
149
  client_manager = DPProxyClientManager()
149
150
 
150
- #
151
- # if __name__ == '__main__':
152
- # co = ChromiumOptions().set_user_agent(
153
- # "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Mobile Safari/537.36")
154
- # tab = ChromiumPage(co).latest_tab
155
- # client = DPProxyClient(tab, self_kill=False)
156
- # # client = CaptchaClient(tab, self_kill=True)
157
- # tab = client.get_driver(True)
158
- # url = "https://api.toutiaoapi.com/feoffline/hotspot_and_local/html/hot_list/index.html?client_extra_params=%7B%22custom_log_pb%22%3A%22%7B%5C%22style_id%5C%22%3A%5C%2240030%5C%22%2C%5C%22entrance_hotspot%5C%22%3A%5C%22search%5C%22%2C%5C%22location%5C%22%3A%5C%22hot_board%5C%22%2C%5C%22category_name%5C%22%3A%5C%22hotboard_light%5C%22%7D%22%7D&count=50&log_pb=%7B%22style_id%22%3A%2240030%22%2C%22entrance_hotspot%22%3A%22search%22%2C%22location%22%3A%22hot_board%22%2C%22category_name%22%3A%22hotboard_light%22%7D&only_hot_list=1&tab_name=stream&enter_keyword=%23%E7%BE%8E%E5%9B%BD%E9%80%80%E5%87%BA66%E4%B8%AA%E5%9B%BD%E9%99%85%E7%BB%84%E7%BB%87%23"
159
- # tab.get(url)
160
- # for _ in range(5056):
161
- # new_packet = client.pop_first_packet()
162
- # print(new_packet, "23")
163
- # time.sleep(1)
151
+ if __name__ == '__main__':
152
+ co = ChromiumOptions().set_user_agent(
153
+ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Mobile Safari/537.36")
154
+ tab = ChromiumPage(co).latest_tab
155
+ client = DPProxyClient(tab, self_kill=False)
156
+ # client = CaptchaClient(tab, self_kill=True)
157
+ tab = client.get_driver(True)
158
+ url = "https://api.toutiaoapi.com/feoffline/hotspot_and_local/html/hot_list/index.html?client_extra_params=%7B%22custom_log_pb%22%3A%22%7B%5C%22style_id%5C%22%3A%5C%2240030%5C%22%2C%5C%22entrance_hotspot%5C%22%3A%5C%22search%5C%22%2C%5C%22location%5C%22%3A%5C%22hot_board%5C%22%2C%5C%22category_name%5C%22%3A%5C%22hotboard_light%5C%22%7D%22%7D&count=50&log_pb=%7B%22style_id%22%3A%2240030%22%2C%22entrance_hotspot%22%3A%22search%22%2C%22location%22%3A%22hot_board%22%2C%22category_name%22%3A%22hotboard_light%22%7D&only_hot_list=1&tab_name=stream&enter_keyword=%23%E7%BE%8E%E5%9B%BD%E9%80%80%E5%87%BA66%E4%B8%AA%E5%9B%BD%E9%99%85%E7%BB%84%E7%BB%87%23"
159
+ tab.get(url)
160
+ for _ in range(5056):
161
+ new_packet = client.pop_first_packet()
162
+ print(new_packet, "23")
163
+ time.sleep(1)
File without changes
File without changes