fix bug
This commit is contained in:
@@ -101,8 +101,14 @@ class Command(BaseCommand):
|
||||
|
||||
# 验证网站名称
|
||||
if websites:
|
||||
# 确保websites是列表类型
|
||||
if isinstance(websites, str):
|
||||
websites = [websites]
|
||||
invalid_websites = [w for w in websites if w not in WEBSITE_SEARCH_CONFIGS]
|
||||
if invalid_websites:
|
||||
# 确保invalid_websites是可迭代的
|
||||
if isinstance(invalid_websites, str):
|
||||
invalid_websites = [invalid_websites]
|
||||
self.stdout.write(
|
||||
self.style.ERROR(f"不支持的网站: {', '.join(invalid_websites)}")
|
||||
)
|
||||
@@ -121,6 +127,9 @@ class Command(BaseCommand):
|
||||
|
||||
self.stdout.write(f"开始一键爬取任务...")
|
||||
self.stdout.write(f"爬取模式: {mode}")
|
||||
# 确保target_websites是可迭代的
|
||||
if isinstance(target_websites, str):
|
||||
target_websites = [target_websites]
|
||||
self.stdout.write(f"目标网站: {', '.join(target_websites)}")
|
||||
if keyword:
|
||||
self.stdout.write(f"关键词: {keyword}")
|
||||
|
||||
@@ -86,8 +86,14 @@ class Command(BaseCommand):
|
||||
|
||||
# 验证网站名称
|
||||
if websites:
|
||||
# 确保websites是列表类型
|
||||
if isinstance(websites, str):
|
||||
websites = [websites]
|
||||
invalid_websites = [w for w in websites if w not in WEBSITE_SEARCH_CONFIGS]
|
||||
if invalid_websites:
|
||||
# 确保invalid_websites是可迭代的
|
||||
if isinstance(invalid_websites, str):
|
||||
invalid_websites = [invalid_websites]
|
||||
self.stdout.write(
|
||||
self.style.ERROR(f"不支持的网站: {', '.join(invalid_websites)}")
|
||||
)
|
||||
@@ -96,7 +102,10 @@ class Command(BaseCommand):
|
||||
|
||||
self.stdout.write(f"开始爬取任务...")
|
||||
self.stdout.write(f"关键词: {keyword}")
|
||||
# 确保websites是可迭代的
|
||||
if websites:
|
||||
if isinstance(websites, str):
|
||||
websites = [websites]
|
||||
self.stdout.write(f"目标网站: {', '.join(websites)}")
|
||||
else:
|
||||
self.stdout.write(f"目标网站: 所有支持的网站 ({len(WEBSITE_SEARCH_CONFIGS)}个)")
|
||||
|
||||
Reference in New Issue
Block a user