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
3f158caf
Commit
3f158caf
authored
Jan 06, 2026
by
Peng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
694247a4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
65 deletions
+68
-65
tk_video_ch_DY.py
..._projects/projects/tiktok/TK_video_data/tk_video_ch_DY.py
+0
-0
tk_video_ch_FA.py
..._projects/projects/tiktok/TK_video_data/tk_video_ch_FA.py
+13
-11
tk_video_ch_ba.py
..._projects/projects/tiktok/TK_video_data/tk_video_ch_ba.py
+15
-14
tk_video_ch_zy.py
..._projects/projects/tiktok/TK_video_data/tk_video_ch_zy.py
+0
-0
tk_video_edg_FA.py
...projects/projects/tiktok/TK_video_data/tk_video_edg_FA.py
+13
-13
tk_video_edg_ba.py
...projects/projects/tiktok/TK_video_data/tk_video_edg_ba.py
+13
-13
tk_video_sum_ch.py
...projects/projects/tiktok/TK_video_data/tk_video_sum_ch.py
+14
-14
No files found.
wangjing_projects/projects/tiktok/TK_video_data/tk_video_ch_DY.py
View file @
3f158caf
This diff is collapsed.
Click to expand it.
wangjing_projects/projects/tiktok/TK_video_data/tk_video_ch_FA.py
View file @
3f158caf
...
...
@@ -85,7 +85,7 @@ class TkVideo():
# 等待页面初始加载
time
.
sleep
(
random
.
randint
(
6
,
10
))
export_orders
=
self
.
page_chrome
.
ele
(
'xpath://span[text()="自定义"]'
,
timeout
=
1
0
)
export_orders
=
self
.
page_chrome
.
ele
(
'xpath://span[text()="自定义"]'
,
timeout
=
1
3
)
export_orders
.
click
()
print
(
'点击自定义'
)
time
.
sleep
(
random
.
randint
(
5
,
10
))
...
...
@@ -102,9 +102,7 @@ class TkVideo():
# 初始目标日期为 deadline(可能已经是上个月的某一天)
max_attempts
=
31
while
max_attempts
>
0
:
for
i
in
range
(
10
):
try
:
xpath
=
(
f
"//div[@class='tiktok-datepicker-month-title' and contains(text(), '{self.end_year} {self.end_month} 月')]"
...
...
@@ -112,7 +110,7 @@ class TkVideo():
f
"//span[text()='{self.end_day}']/parent::div"
)
print
(
'结束日期 xpath::'
,
xpath
)
ele
=
self
.
page_chrome
.
ele
(
f
"xpath={xpath}"
,
timeout
=
5
)
ele
=
self
.
page_chrome
.
ele
(
f
"xpath={xpath}"
,
timeout
=
8
)
ele
.
click
()
print
(
f
'✅ 成功点击日期:{self.end_year}-{self.end_month}-{self.end_day}'
)
self
.
get_data
()
...
...
@@ -133,24 +131,24 @@ class TkVideo():
def
get_data
(
self
):
try
:
self
.
page_chrome
.
ele
(
'xpath://div[text()="更新"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://div[text()="更新"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击更新'
)
sleep
(
randint
(
5
,
10
))
self
.
page_chrome
.
ele
(
'xpath://span[text()="下载数据"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://span[text()="下载数据"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击下载数据'
)
sleep
(
randint
(
5
,
10
))
self
.
page_chrome
.
ele
(
'xpath://span[text()="Xlsx"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://span[text()="Xlsx"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击Xlsx'
)
sleep
(
randint
(
5
,
10
))
self
.
page_chrome
.
ele
(
'xpath://button[text()="下载数据"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://button[text()="下载数据"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击下载数据'
)
sleep
(
randint
(
5
,
10
))
# 点击首页 获取店铺名称
self
.
page_chrome
.
ele
(
'xpath://span[text()="首页"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://span[text()="首页"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击首页'
)
sleep
(
randint
(
5
,
10
))
...
...
@@ -293,7 +291,11 @@ class TkVideo():
data
=
self
.
read_excel
(
EXCEL_FILE
)
processed_data
=
self
.
process_data
(
data
,
self
.
shop_name
)
self
.
store_data_in_redis
(
self
.
r
,
processed_data
)
try
:
print
(
'删除下载文件'
,
EXCEL_FILE
)
os
.
remove
(
EXCEL_FILE
)
except
:
print
(
'删除数据失败'
)
def
send_success_message_via_wechat
(
self
):
webhook_url
=
'http://47.112.96.71:8082/selection/sendMessage'
# 替换为你的企业微信机器人的Webhook URL
data
=
{
...
...
wangjing_projects/projects/tiktok/TK_video_data/tk_video_ch_ba.py
View file @
3f158caf
...
...
@@ -15,7 +15,7 @@ import redis
import
json
from
pathlib
import
Path
import
re
from
sqlalchemy
import
create_engine
import
random
class
TkVideo
():
...
...
@@ -84,7 +84,7 @@ class TkVideo():
# 等待页面初始加载
time
.
sleep
(
random
.
randint
(
6
,
10
))
export_orders
=
self
.
page_chrome
.
ele
(
'xpath://span[text()="自定义"]'
,
timeout
=
1
0
)
export_orders
=
self
.
page_chrome
.
ele
(
'xpath://span[text()="自定义"]'
,
timeout
=
1
3
)
export_orders
.
click
()
print
(
'点击自定义'
)
time
.
sleep
(
random
.
randint
(
5
,
10
))
...
...
@@ -98,10 +98,7 @@ class TkVideo():
)
.
click
()
print
(
f
'已输入开始时间{self.start_year} {self.start_month} 月 {self.start_day} 日'
)
time
.
sleep
(
random
.
randint
(
3
,
5
))
max_attempts
=
31
while
max_attempts
>
0
:
for
i
in
range
(
10
):
try
:
xpath
=
(
f
"//div[@class='tiktok-datepicker-month-title' and contains(text(), '{self.end_year} {self.end_month} 月')]"
...
...
@@ -109,11 +106,11 @@ class TkVideo():
f
"//span[text()='{self.end_day}']/parent::div"
)
print
(
'结束日期 xpath::'
,
xpath
)
ele
=
self
.
page_chrome
.
ele
(
f
"xpath={xpath}"
,
timeout
=
5
)
ele
=
self
.
page_chrome
.
ele
(
f
"xpath={xpath}"
,
timeout
=
8
)
ele
.
click
()
print
(
f
'✅ 成功点击日期:{self.end_year}-{self.end_month}-{self.end_day}'
)
self
.
get_data
()
time
.
sleep
(
random
.
randint
(
3
,
5
))
time
.
sleep
(
random
.
randint
(
5
,
8
))
return
True
# 成功返回
except
Exception
as
e
:
...
...
@@ -130,24 +127,24 @@ class TkVideo():
def
get_data
(
self
):
try
:
self
.
page_chrome
.
ele
(
'xpath://div[text()="更新"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://div[text()="更新"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击更新'
)
sleep
(
randint
(
5
,
10
))
self
.
page_chrome
.
ele
(
'xpath://span[text()="下载数据"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://span[text()="下载数据"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击下载数据'
)
sleep
(
randint
(
5
,
10
))
self
.
page_chrome
.
ele
(
'xpath://span[text()="Xlsx"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://span[text()="Xlsx"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击Xlsx'
)
sleep
(
randint
(
5
,
10
))
self
.
page_chrome
.
ele
(
'xpath://button[text()="下载数据"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://button[text()="下载数据"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击下载数据'
)
sleep
(
randint
(
5
,
10
))
# 点击首页 获取店铺名称
self
.
page_chrome
.
ele
(
'xpath://span[text()="首页"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://span[text()="首页"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击首页'
)
sleep
(
randint
(
5
,
10
))
...
...
@@ -290,7 +287,11 @@ class TkVideo():
data
=
self
.
read_excel
(
EXCEL_FILE
)
processed_data
=
self
.
process_data
(
data
,
self
.
shop_name
)
self
.
store_data_in_redis
(
self
.
r
,
processed_data
)
try
:
print
(
'删除下载文件'
,
EXCEL_FILE
)
os
.
remove
(
EXCEL_FILE
)
except
:
print
(
'删除数据失败'
)
def
send_success_message_via_wechat
(
self
):
webhook_url
=
'http://47.112.96.71:8082/selection/sendMessage'
# 替换为你的企业微信机器人的Webhook URL
data
=
{
...
...
wangjing_projects/projects/tiktok/TK_video_data/tk_video_ch_zy.py
View file @
3f158caf
This diff is collapsed.
Click to expand it.
wangjing_projects/projects/tiktok/TK_video_data/tk_video_edg_FA.py
View file @
3f158caf
...
...
@@ -90,7 +90,7 @@ class TkVideo():
# 等待页面初始加载
time
.
sleep
(
random
.
randint
(
6
,
10
))
export_orders
=
self
.
page_edge
.
ele
(
'xpath://span[text()="自定义"]'
,
timeout
=
1
0
)
export_orders
=
self
.
page_edge
.
ele
(
'xpath://span[text()="自定义"]'
,
timeout
=
1
3
)
export_orders
.
click
()
print
(
'点击自定义'
)
time
.
sleep
(
random
.
randint
(
5
,
10
))
...
...
@@ -104,11 +104,7 @@ class TkVideo():
)
.
click
()
print
(
f
'已输入开始时间{self.start_year} {self.start_month} 月 {self.start_day} 日'
)
time
.
sleep
(
random
.
randint
(
3
,
5
))
max_attempts
=
31
while
max_attempts
>
0
:
for
i
in
range
(
10
):
try
:
xpath
=
(
f
"//div[@class='tiktok-datepicker-month-title' and contains(text(), '{self.end_year} {self.end_month} 月')]"
...
...
@@ -116,7 +112,7 @@ class TkVideo():
f
"//span[text()='{self.end_day}']/parent::div"
)
print
(
'结束日期 xpath::'
,
xpath
)
ele
=
self
.
page_edge
.
ele
(
f
"xpath={xpath}"
,
timeout
=
5
)
ele
=
self
.
page_edge
.
ele
(
f
"xpath={xpath}"
,
timeout
=
8
)
ele
.
click
()
print
(
f
'✅ 成功点击日期:{self.end_year}-{self.end_month}-{self.end_day}'
)
self
.
get_data
()
...
...
@@ -137,24 +133,24 @@ class TkVideo():
def
get_data
(
self
):
try
:
self
.
page_edge
.
ele
(
'xpath://div[text()="更新"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_edge
.
ele
(
'xpath://div[text()="更新"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击更新'
)
sleep
(
randint
(
5
,
10
))
self
.
page_edge
.
ele
(
'xpath://span[text()="下载数据"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_edge
.
ele
(
'xpath://span[text()="下载数据"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击下载数据'
)
sleep
(
randint
(
5
,
10
))
self
.
page_edge
.
ele
(
'xpath://span[text()="Xlsx"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_edge
.
ele
(
'xpath://span[text()="Xlsx"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击Xlsx'
)
sleep
(
randint
(
5
,
10
))
self
.
page_edge
.
ele
(
'xpath://button[text()="下载数据"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_edge
.
ele
(
'xpath://button[text()="下载数据"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击下载数据'
)
sleep
(
randint
(
5
,
10
))
# 点击首页 获取店铺名称
self
.
page_edge
.
ele
(
'xpath://span[text()="首页"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_edge
.
ele
(
'xpath://span[text()="首页"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击首页'
)
sleep
(
randint
(
5
,
10
))
...
...
@@ -298,7 +294,11 @@ class TkVideo():
data
=
self
.
read_excel
(
EXCEL_FILE
)
processed_data
=
self
.
process_data
(
data
,
self
.
shop_name
)
self
.
store_data_in_redis
(
self
.
r
,
processed_data
)
try
:
print
(
'删除下载文件'
,
EXCEL_FILE
)
os
.
remove
(
EXCEL_FILE
)
except
:
print
(
'删除数据失败'
)
def
send_success_message_via_wechat
(
self
):
webhook_url
=
'http://47.112.96.71:8082/selection/sendMessage'
# 替换为你的企业微信机器人的Webhook URL
data
=
{
...
...
wangjing_projects/projects/tiktok/TK_video_data/tk_video_edg_ba.py
View file @
3f158caf
...
...
@@ -89,7 +89,7 @@ class TkVideo():
# 等待页面初始加载
time
.
sleep
(
random
.
randint
(
6
,
10
))
export_orders
=
self
.
page_edge
.
ele
(
'xpath://span[text()="自定义"]'
,
timeout
=
1
0
)
export_orders
=
self
.
page_edge
.
ele
(
'xpath://span[text()="自定义"]'
,
timeout
=
1
3
)
export_orders
.
click
()
print
(
'点击自定义'
)
time
.
sleep
(
random
.
randint
(
5
,
10
))
...
...
@@ -104,11 +104,7 @@ class TkVideo():
print
(
f
'已输入开始时间{self.start_year} {self.start_month} 月 {self.start_day} 日'
)
time
.
sleep
(
random
.
randint
(
3
,
5
))
max_attempts
=
31
while
max_attempts
>
0
:
for
i
in
range
(
10
):
try
:
xpath
=
(
f
"//div[@class='tiktok-datepicker-month-title' and contains(text(), '{self.end_year} {self.end_month} 月')]"
...
...
@@ -116,7 +112,7 @@ class TkVideo():
f
"//span[text()='{self.end_day}']/parent::div"
)
print
(
'结束日期 xpath::'
,
xpath
)
ele
=
self
.
page_edge
.
ele
(
f
"xpath={xpath}"
,
timeout
=
5
)
ele
=
self
.
page_edge
.
ele
(
f
"xpath={xpath}"
,
timeout
=
8
)
ele
.
click
()
print
(
f
'✅ 成功点击日期:{self.end_year}-{self.end_month}-{self.end_day}'
)
self
.
get_data
()
...
...
@@ -137,24 +133,24 @@ class TkVideo():
def
get_data
(
self
):
try
:
self
.
page_edge
.
ele
(
'xpath://div[text()="更新"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_edge
.
ele
(
'xpath://div[text()="更新"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击更新'
)
sleep
(
randint
(
5
,
10
))
self
.
page_edge
.
ele
(
'xpath://span[text()="下载数据"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_edge
.
ele
(
'xpath://span[text()="下载数据"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击下载数据'
)
sleep
(
randint
(
5
,
10
))
self
.
page_edge
.
ele
(
'xpath://span[text()="Xlsx"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_edge
.
ele
(
'xpath://span[text()="Xlsx"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击Xlsx'
)
sleep
(
randint
(
5
,
10
))
self
.
page_edge
.
ele
(
'xpath://button[text()="下载数据"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_edge
.
ele
(
'xpath://button[text()="下载数据"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击下载数据'
)
sleep
(
randint
(
5
,
10
))
# 点击首页 获取店铺名称
self
.
page_edge
.
ele
(
'xpath://span[text()="首页"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_edge
.
ele
(
'xpath://span[text()="首页"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击首页'
)
sleep
(
randint
(
5
,
10
))
...
...
@@ -298,7 +294,11 @@ class TkVideo():
data
=
self
.
read_excel
(
EXCEL_FILE
)
processed_data
=
self
.
process_data
(
data
,
self
.
shop_name
)
self
.
store_data_in_redis
(
self
.
r
,
processed_data
)
try
:
print
(
'删除下载文件'
,
EXCEL_FILE
)
os
.
remove
(
EXCEL_FILE
)
except
:
print
(
'删除数据失败'
)
def
send_success_message_via_wechat
(
self
):
webhook_url
=
'http://47.112.96.71:8082/selection/sendMessage'
# 替换为你的企业微信机器人的Webhook URL
data
=
{
...
...
wangjing_projects/projects/tiktok/TK_video_data/tk_video_sum_ch.py
View file @
3f158caf
...
...
@@ -87,7 +87,7 @@ class TkVideo():
# 等待页面初始加载
time
.
sleep
(
random
.
randint
(
6
,
10
))
export_orders
=
self
.
page_chrome
.
ele
(
'xpath://span[text()="自定义"]'
,
timeout
=
1
0
)
export_orders
=
self
.
page_chrome
.
ele
(
'xpath://span[text()="自定义"]'
,
timeout
=
1
3
)
export_orders
.
click
()
print
(
'点击自定义'
)
time
.
sleep
(
random
.
randint
(
5
,
10
))
...
...
@@ -101,11 +101,7 @@ class TkVideo():
)
.
click
()
print
(
f
'已输入开始时间{self.start_year} {self.start_month} 月 {self.start_day} 日'
)
time
.
sleep
(
random
.
randint
(
3
,
5
))
max_attempts
=
31
while
max_attempts
>
0
:
for
i
in
range
(
10
):
try
:
xpath
=
(
f
"//div[@class='tiktok-datepicker-month-title' and contains(text(), '{self.end_year} {self.end_month} 月')]"
...
...
@@ -113,7 +109,7 @@ class TkVideo():
f
"//span[text()='{self.end_day}']/parent::div"
)
print
(
'结束日期 xpath::'
,
xpath
)
ele
=
self
.
page_chrome
.
ele
(
f
"xpath={xpath}"
,
timeout
=
5
)
ele
=
self
.
page_chrome
.
ele
(
f
"xpath={xpath}"
,
timeout
=
8
)
ele
.
click
()
print
(
f
'✅ 成功点击日期:{self.end_year}-{self.end_month}-{self.end_day}'
)
self
.
get_data
()
...
...
@@ -134,28 +130,28 @@ class TkVideo():
def
get_data
(
self
):
try
:
self
.
page_chrome
.
ele
(
'xpath://div[text()="更新"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://div[text()="更新"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击更新'
)
sleep
(
randint
(
5
,
10
))
self
.
page_chrome
.
ele
(
'xpath://span[text()="下载数据"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://span[text()="下载数据"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击下载数据'
)
sleep
(
randint
(
5
,
10
))
self
.
page_chrome
.
ele
(
'xpath://span[text()="Xlsx"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://span[text()="Xlsx"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击Xlsx'
)
sleep
(
randint
(
5
,
10
))
self
.
page_chrome
.
ele
(
'xpath://button[text()="下载数据"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://button[text()="下载数据"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击下载数据'
)
sleep
(
randint
(
5
,
10
))
# 点击首页 获取店铺名称
self
.
page_chrome
.
ele
(
'xpath://span[text()="首页"]'
,
timeout
=
1
0
)
.
click
()
self
.
page_chrome
.
ele
(
'xpath://span[text()="首页"]'
,
timeout
=
1
3
)
.
click
()
print
(
'已点击首页'
)
sleep
(
randint
(
5
,
10
))
self
.
shop_name
=
self
.
page_chrome
.
ele
(
'xpath://div[@class="text-H6-Bold"]'
)
.
text
self
.
shop_name
=
self
.
page_chrome
.
ele
(
'xpath://div[@class="
flex items-center"]//div[@class="
text-H6-Bold"]'
)
.
text
print
(
f
'已获取店铺名: {self.shop_name}'
)
sleep
(
randint
(
5
,
10
))
...
...
@@ -294,7 +290,11 @@ class TkVideo():
data
=
self
.
read_excel
(
EXCEL_FILE
)
processed_data
=
self
.
process_data
(
data
,
self
.
shop_name
)
self
.
store_data_in_redis
(
self
.
r
,
processed_data
)
try
:
print
(
'删除下载文件'
,
EXCEL_FILE
)
os
.
remove
(
EXCEL_FILE
)
except
:
print
(
'删除数据失败'
)
def
send_success_message_via_wechat
(
self
):
webhook_url
=
'http://47.112.96.71:8082/selection/sendMessage'
# 替换为你的企业微信机器人的Webhook URL
data
=
{
...
...
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