Skip to content

Commit 62489b1

Browse files
Merge pull request #33 from jinwandalaohu66/submission/cookie_mmyqkjvd
2 parents 7ac3cff + 04fa90e commit 62489b1

2 files changed

Lines changed: 76 additions & 2 deletions

File tree

script_library/index.json

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 1,
3-
"data_version": 11,
4-
"updated": "2026-03-19T15:52:16.644Z",
3+
"data_version": 12,
4+
"updated": "2026-03-20T10:08:23.591Z",
55
"announcement": null,
66
"categories": [
77
{
@@ -449,6 +449,29 @@
449449
"updated": null,
450450
"status": "active",
451451
"lines": 85
452+
},
453+
{
454+
"id": "cookie_mmyqkjvd",
455+
"name": "解析 Cookie,请认真看上面的提醒哦。",
456+
"name_en": "解析 Cookie,请认真看上面的提醒哦。",
457+
"desc": "这就是解析 Cookie",
458+
"desc_en": "这就是解析 Cookie",
459+
"category": "basic",
460+
"file": "scripts/basic/cookie_mmyqkjvd.py",
461+
"thumbnail": null,
462+
"version": 1,
463+
"file_type": "py",
464+
"author": "Silence",
465+
"author_en": "Silence",
466+
"tags": [
467+
"community"
468+
],
469+
"requires": [],
470+
"min_app_version": "1.5.0",
471+
"added": "2026-03-20",
472+
"updated": null,
473+
"status": "active",
474+
"lines": 51
452475
}
453476
]
454477
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# 欢迎使用 PythonIDE!如果觉得好用,请给个好评哦~
2+
import re
3+
import os
4+
5+
def parse_curl_and_save():
6+
# ⚠️ ,把你用 Stream 抓包复制的那一整坨💩 Curl 代码粘贴到下面三个引号中间
7+
raw_curl = """放在这里哦不要删除符号哦😊"""
8+
9+
# --- 1. 暴力正则提取 URL ---
10+
# 匹配 curl 后面的第一个 http/https 链接
11+
url_match = re.search(r"(?i)curl\s+['\"]?(https?://[^'\"]+)['\"]?", raw_curl)
12+
url = url_match.group(1) if url_match else "❌ 未解析到 URL"
13+
14+
# --- 2. 暴力正则提取 Cookie ---
15+
# 匹配 -H 'Cookie: xxxx' 里面的内容
16+
cookie_match = re.search(r"(?i)-H\s+['\"]?Cookie:\s*([^'\"]+)['\"]?", raw_curl)
17+
cookie = cookie_match.group(1) if cookie_match else "❌ 未解析到 Cookie"
18+
19+
# --- 3. 暴力正则提取 User-Agent ---
20+
# 匹配 -H 'User-Agent: xxxx' 里面的内容
21+
ua_match = re.search(r"(?i)-H\s+['\"]?User-Agent:\s*([^'\"]+)['\"]?", raw_curl)
22+
user_agent = ua_match.group(1) if ua_match else "❌ 未解析到 User-Agent"
23+
24+
# --- 4. 组装极度舒适的排版 ---
25+
output_text = (
26+
" 联通抓包数据解析成功 \n"
27+
"可以直接把下面的内容一段段复制到小组件脚本里了,⚠️host填写m.client.10010.com\n\n"
28+
"================ [ 1. URL 链接 ] ================\n"
29+
f"{url}\n\n"
30+
"================ [ 2. User-Agent ] ================\n"
31+
f"{user_agent}\n\n"
32+
"================ [ 3. Cookie (核心) ] ================\n"
33+
f"{cookie}\n\n"
34+
"=================================================\n"
35+
)
36+
37+
# --- 5. 自动创建并保存到新文件 ---
38+
# 会在你的 PythonIDE 当前目录下生成这个 txt 文件
39+
file_name = "API提取结果.txt"
40+
try:
41+
with open(file_name, "w", encoding="utf-8") as f:
42+
f.write(output_text)
43+
print(f" 搞定!已成功帮你把数据分段提取,并存入了新文件:【{file_name}\n")
44+
print(" 预览一下内容 记得还有 host 哦臭宝\n")
45+
print(output_text)
46+
except Exception as e:
47+
print(f"❌ 写入文件失败了: {e}")
48+
49+
if __name__ == "__main__":
50+
parse_curl_and_save()
51+
#2026-3-20

0 commit comments

Comments
 (0)