Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spider
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
selection-new
spider
Commits
d93089c5
Commit
d93089c5
authored
Jun 24, 2026
by
hejiangming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
b441e323
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
35 deletions
+1
-35
fastapi_server.py
...pider_code/app_amazon_image_recognition/fastapi_server.py
+0
-34
ua_tls_profiles.py
...ider_code/app_amazon_image_recognition/ua_tls_profiles.py
+1
-1
No files found.
hjm_spider_code/app_amazon_image_recognition/fastapi_server.py
View file @
d93089c5
...
@@ -17,34 +17,6 @@ class ImageSearchRequest(BaseModel):
...
@@ -17,34 +17,6 @@ class ImageSearchRequest(BaseModel):
image_url
:
str
=
Field
(
...
,
description
=
"图片的URL地址"
)
image_url
:
str
=
Field
(
...
,
description
=
"图片的URL地址"
)
site_name
:
str
=
Field
(
default
=
"us"
,
description
=
"站点简写, 如 us"
)
site_name
:
str
=
Field
(
default
=
"us"
,
description
=
"站点简写, 如 us"
)
search_mode
:
str
=
Field
(
default
=
"default"
,
description
=
"搜索模式"
)
search_mode
:
str
=
Field
(
default
=
"default"
,
description
=
"搜索模式"
)
# ======================
# 首页
# ======================
@app.get
(
"/"
,
response_class
=
HTMLResponse
)
def
index
():
html_content
=
"""
<html>
<head><meta charset="utf-8"><title>Amazon Image Search API</title></head>
<body style="font-family: Arial; padding:40px;">
<h1>📸 Amazon Image Search API (FastAPI)</h1>
<p style="color:green;font-weight:bold;">服务正在运行</p>
<h3>接口:</h3>
<p><b>POST /api/search_image</b></p>
<pre>
{
"image_url": "https://m.media-amazon.com/images/I/51i3aMcjmOL._SL600_.jpg",
"site_name": "us", // 可选: us
"search_mode": "default" // 可选: default, full_image
}
</pre>
<h3>健康检查:</h3>
<p><a href="/health">/health</a></p>
</body>
</html>
"""
return
HTMLResponse
(
content
=
html_content
)
# ======================
# ======================
...
@@ -177,9 +149,3 @@ def search_image_api(item: ImageSearchRequest):
...
@@ -177,9 +149,3 @@ def search_image_api(item: ImageSearchRequest):
return
JSONResponse
({
"code"
:
500
,
"msg"
:
str
(
e
)},
status_code
=
500
)
return
JSONResponse
({
"code"
:
500
,
"msg"
:
str
(
e
)},
status_code
=
500
)
# ======================
# 健康检查
# ======================
@app.get
(
"/health"
)
async
def
health
():
return
{
"status"
:
"ok"
,
"service"
:
"Amazon Image Search (FastAPI)"
}
hjm_spider_code/app_amazon_image_recognition/ua_tls_profiles.py
View file @
d93089c5
...
@@ -39,7 +39,7 @@ def build_browser_headers():
...
@@ -39,7 +39,7 @@ def build_browser_headers():
v
=
profile
[
"version"
]
v
=
profile
[
"version"
]
headers
=
{
headers
=
{
"accept"
:
"text/html,application/xhtml+xml,*/*"
,
"accept"
:
"text/html,application/xhtml+xml,*/*"
,
"Accept-Language"
:
"
en-US
,en;q=0.9"
,
"Accept-Language"
:
"
zh-CN
,en;q=0.9"
,
"Accept-Encoding"
:
"gzip, deflate"
,
"Accept-Encoding"
:
"gzip, deflate"
,
"user-agent"
:
profile
[
"ua"
],
"user-agent"
:
profile
[
"ua"
],
"sec-ch-ua"
:
f
'"Chromium";v="{v}", "Google Chrome";v="{v}", "Not.A/Brand";v="99"'
,
"sec-ch-ua"
:
f
'"Chromium";v="{v}", "Google Chrome";v="{v}", "Not.A/Brand";v="99"'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment