- 前台页面全面升级为Tailwind CSS框架 - 引入Google Fonts (Space Grotesk, Noto Sans) - 主色调更新为#25c0f4 (cyan blue) - 实现玻璃态效果和渐变背景 - 优化首页网格卡片布局和悬停动画 - 优化详情页双栏布局和渐变Logo光晕 - 优化管理员登录页,添加科技网格背景 - Flask-Admin后台完整深色主题 - 统一Material Symbols图标系统 - 网站自动抓取功能界面优化 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
测试网站信息抓取功能
|
|
"""
|
|
import sys
|
|
if sys.platform.startswith('win'):
|
|
import io
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
|
|
from utils.website_fetcher import WebsiteFetcher
|
|
|
|
def test_fetch():
|
|
"""测试抓取百度网站信息"""
|
|
print("="*50)
|
|
print("测试网站信息抓取功能")
|
|
print("="*50)
|
|
|
|
# 创建抓取器
|
|
fetcher = WebsiteFetcher(timeout=15)
|
|
|
|
# 测试抓取百度
|
|
test_url = "https://www.baidu.com"
|
|
print(f"\n正在抓取: {test_url}")
|
|
|
|
info = fetcher.fetch_website_info(test_url)
|
|
|
|
if info:
|
|
print("\n抓取成功!")
|
|
print("-"*50)
|
|
print(f"网站名称: {info.get('name', '')}")
|
|
print(f"网站描述: {info.get('description', '')}")
|
|
print(f"Logo URL: {info.get('logo_url', '')}")
|
|
print("-"*50)
|
|
|
|
# 测试下载Logo
|
|
if info.get('logo_url'):
|
|
print(f"\n正在下载Logo...")
|
|
logo_path = fetcher.download_logo(info['logo_url'])
|
|
if logo_path:
|
|
print(f"Logo下载成功: {logo_path}")
|
|
else:
|
|
print("Logo下载失败")
|
|
else:
|
|
print("\n抓取失败!")
|
|
|
|
if __name__ == '__main__':
|
|
test_fetch()
|