Skip to content

Commit 07bcd5f

Browse files
demo
1 parent 5198d3b commit 07bcd5f

File tree

10 files changed

+21
-16
lines changed

10 files changed

+21
-16
lines changed

AutoScraperX.egg-info/PKG-INFO

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: AutoScraperX
3-
Version: 0.1.0
3+
Version: 0.1.1
44
Summary: A common spider tool based on Selenium
55
Home-page: https://github.com/chenziying1/AutoScraperX
66
Author: czy
@@ -42,7 +42,7 @@ pip install selenium undetected-chromedriver beautifulsoup4
4242
### 初始化爬虫
4343

4444
```
45-
from common_spider import Spider
45+
from AutoScraperX import common_spider # 确保 Spider 类已正确导入
4646

4747
options = {
4848
'headless': True, # 以无头模式运行
@@ -51,7 +51,7 @@ options = {
5151
'driver_executable_path': "C:\\Path\\To\\chromedriver.exe"
5252
}
5353

54-
spider = Spider(options)
54+
spider = common_spider.Spider(options)
5555
```
5656

5757
### 打开网页

AutoScraperX/common_spider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(self, options: dict = {}, path: str=None, name: str = None):
9090
defualt_options.add_argument('--start-maximized')
9191

9292
# 设置浏览器选项
93-
defualt_options.binary_location = options.get('binary_location', "C:\Users\Administrator\AppData\Local\Google\Chrome\Bin\chrome.exe")
93+
defualt_options.binary_location = options.get('binary_location', r"C:\Users\Administrator\AppData\Local\Google\Chrome\Bin\chrome.exe")
9494

9595
if options.get('fastest', False):
9696
defualt_options.add_argument("--disable-extensions")

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pip install selenium undetected-chromedriver beautifulsoup4
2727
### 初始化爬虫
2828

2929
```
30-
from common_spider import Spider
30+
from AutoScraperX import common_spider # 确保 Spider 类已正确导入
3131
3232
options = {
3333
'headless': True, # 以无头模式运行
@@ -36,7 +36,7 @@ options = {
3636
'driver_executable_path': "C:\\Path\\To\\chromedriver.exe"
3737
}
3838
39-
spider = Spider(options)
39+
spider = common_spider.Spider(options)
4040
```
4141

4242
### 打开网页

build/lib/AutoScraperX/common_spider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(self, options: dict = {}, path: str=None, name: str = None):
9090
defualt_options.add_argument('--start-maximized')
9191

9292
# 设置浏览器选项
93-
defualt_options.binary_location = options.get('binary_location', "C:\Users\Administrator\AppData\Local\Google\Chrome\Bin\chrome.exe")
93+
defualt_options.binary_location = options.get('binary_location', r"C:\Users\Administrator\AppData\Local\Google\Chrome\Bin\chrome.exe")
9494

9595
if options.get('fastest', False):
9696
defualt_options.add_argument("--disable-extensions")
-6.46 KB
Binary file not shown.
6.48 KB
Binary file not shown.

dist/autoscraperx-0.1.0.tar.gz

-6.48 KB
Binary file not shown.

dist/autoscraperx-0.1.1.tar.gz

6.47 KB
Binary file not shown.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="AutoScraperX", # 你的库名称
5-
version="0.1.0", # 版本号
5+
version="0.1.1", # 版本号
66
author="czy",
77
author_email="1060324818@qq.com",
88
description="A common spider tool based on Selenium",

test/test.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,22 @@
88
email :1060324818@qq.com
99
'''
1010

11-
from AutoScraperX import Spider # 确保 Spider 类已正确导入
11+
from AutoScraperX import common_spider # 确保 Spider 类已正确导入
1212

1313
def main():
1414
# 创建 Spider 实例
15-
spider = Spider(
16-
headless=True, # 是否无头模式运行
17-
proxy=None, # 可选代理设置
18-
timeout=10, # 超时时间(秒)
19-
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
20-
wait_time=5 # 页面加载后等待时间
21-
)
15+
# 配置爬虫选项
16+
options = {
17+
"driver_executable_path": "chromedriver\\chromedriver.exe", # 替换为你的 chromedriver 路径
18+
"user_data_dir": "data\\User Data", # Chrome 用户数据路径
19+
"profile_directory": "Default", # Chrome 配置文件
20+
"headless": False, # 是否启用无头模式(True = 不显示浏览器窗口)
21+
"maximized": True, # 是否最大化窗口
22+
"logging_level": 2 # 日志级别
23+
}
24+
25+
# 创建 Spider 实例
26+
spider = common_spider.Spider(options=options)
2227

2328
try:
2429
# 打开网页

0 commit comments

Comments
 (0)