Initial commit: HBR 文章爬蟲專案

- Scrapy 爬蟲框架,爬取 HBR 繁體中文文章
- Flask Web 應用程式,提供文章查詢介面
- SQL Server 資料庫整合
- 自動化排程與郵件通知功能

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-03 17:19:56 +08:00
commit f524713cb6
35 changed files with 6719 additions and 0 deletions

537
static/style.css Normal file
View File

@@ -0,0 +1,537 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Microsoft JhengHei', 'Segoe UI', Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
color: #333;
}
.container {
max-width: 1400px;
margin: 0 auto;
background: white;
border-radius: 15px;
box-shadow: 0 10px 40px rgba(0,0,0,0.2);
overflow: hidden;
}
header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 30px;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
header h1 {
font-size: 2em;
margin: 0;
}
.header-actions {
display: flex;
gap: 10px;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
transition: all 0.3s;
font-weight: bold;
}
.btn-primary {
background: #4CAF50;
color: white;
}
.btn-primary:hover {
background: #45a049;
transform: translateY(-2px);
}
.btn-success {
background: #2196F3;
color: white;
}
.btn-success:hover {
background: #0b7dda;
transform: translateY(-2px);
}
.btn-secondary {
background: #757575;
color: white;
}
.btn-secondary:hover {
background: #616161;
}
section {
padding: 30px;
border-bottom: 1px solid #eee;
}
section:last-child {
border-bottom: none;
}
h2 {
color: #667eea;
margin-bottom: 20px;
font-size: 1.5em;
}
/* 統計面板 */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.stat-card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 25px;
border-radius: 10px;
text-align: center;
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
transition: transform 0.3s;
}
.stat-card:hover {
transform: translateY(-5px);
}
.stat-label {
font-size: 14px;
opacity: 0.9;
margin-bottom: 10px;
}
.stat-value {
font-size: 2.5em;
font-weight: bold;
}
.charts-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
gap: 20px;
}
.chart-box {
background: #f8f9fa;
padding: 20px;
border-radius: 10px;
}
.chart-box h3 {
margin-bottom: 15px;
color: #667eea;
}
/* 查詢表單 */
.search-form {
background: #f8f9fa;
padding: 20px;
border-radius: 10px;
}
.form-row {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin-bottom: 15px;
}
.form-group {
display: flex;
flex-direction: column;
}
.form-group label {
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
.form-group input,
.form-group select {
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 14px;
}
.form-group input:focus,
.form-group select:focus {
outline: none;
border-color: #667eea;
}
/* 文章列表 */
.articles-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.pagination-info {
color: #666;
font-size: 14px;
}
.articles-list {
display: grid;
gap: 15px;
}
.article-card {
background: #f8f9fa;
padding: 20px;
border-radius: 10px;
border-left: 4px solid #667eea;
transition: all 0.3s;
cursor: pointer;
}
.article-card:hover {
background: #e9ecef;
transform: translateX(5px);
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.article-title {
font-size: 1.2em;
font-weight: bold;
color: #667eea;
margin-bottom: 10px;
text-decoration: none;
}
.article-title:hover {
text-decoration: underline;
}
.article-meta {
display: flex;
flex-wrap: wrap;
gap: 15px;
font-size: 14px;
color: #666;
margin-bottom: 10px;
}
.article-meta span {
display: flex;
align-items: center;
gap: 5px;
}
.article-summary {
color: #555;
line-height: 1.6;
margin-top: 10px;
}
.article-tags {
margin-top: 10px;
}
.tag {
display: inline-block;
background: #667eea;
color: white;
padding: 3px 10px;
border-radius: 15px;
font-size: 12px;
margin-right: 5px;
}
.paywall-badge {
background: #ff9800;
color: white;
padding: 3px 10px;
border-radius: 15px;
font-size: 12px;
font-weight: bold;
}
/* 分頁 */
.pagination {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 20px;
}
.pagination button {
padding: 8px 15px;
border: 1px solid #ddd;
background: white;
border-radius: 5px;
cursor: pointer;
transition: all 0.3s;
}
.pagination button:hover:not(:disabled) {
background: #667eea;
color: white;
border-color: #667eea;
}
.pagination button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.pagination .active {
background: #667eea;
color: white;
border-color: #667eea;
}
/* 載入動畫 */
.loading {
text-align: center;
padding: 40px;
font-size: 18px;
color: #667eea;
display: none;
}
.loading.show {
display: block;
}
/* 模態框 */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
overflow: auto;
}
.modal-content {
background-color: white;
margin: 5% auto;
padding: 30px;
border-radius: 10px;
width: 90%;
max-width: 800px;
max-height: 80vh;
overflow-y: auto;
}
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
cursor: pointer;
}
.close:hover {
color: #000;
}
#articleDetail {
margin-top: 20px;
}
.article-detail-title {
font-size: 1.8em;
color: #667eea;
margin-bottom: 15px;
}
.article-detail-content {
line-height: 1.8;
color: #555;
margin-top: 20px;
}
/* 頁籤樣式 */
.tabs {
display: flex;
background: #f8f9fa;
border-bottom: 2px solid #667eea;
padding: 0 30px;
}
.tab-btn {
padding: 15px 30px;
background: transparent;
border: none;
border-bottom: 3px solid transparent;
cursor: pointer;
font-size: 16px;
font-weight: bold;
color: #666;
transition: all 0.3s;
}
.tab-btn:hover {
color: #667eea;
background: rgba(102, 126, 234, 0.1);
}
.tab-btn.active {
color: #667eea;
border-bottom-color: #667eea;
background: white;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
/* 爬蟲設定頁面 */
.config-section {
padding: 30px;
}
.config-group {
background: #f8f9fa;
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
}
.config-group h3 {
color: #667eea;
margin-bottom: 15px;
font-size: 1.2em;
}
.config-group small {
display: block;
color: #666;
font-size: 12px;
margin-top: 5px;
}
.url-list-container {
margin-top: 15px;
}
.url-list {
margin-bottom: 10px;
}
.url-item {
display: flex;
align-items: center;
gap: 10px;
padding: 10px;
background: white;
border-radius: 5px;
margin-bottom: 10px;
}
.url-item input {
flex: 1;
padding: 8px;
border: 1px solid #ddd;
border-radius: 5px;
}
.url-item button {
padding: 8px 15px;
background: #dc3545;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.url-item button:hover {
background: #c82333;
}
.config-actions {
display: flex;
gap: 10px;
margin-top: 20px;
flex-wrap: wrap;
}
.config-status {
margin-top: 20px;
padding: 15px;
border-radius: 5px;
display: none;
}
.config-status.success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
display: block;
}
.config-status.error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
display: block;
}
.config-status.info {
background: #d1ecf1;
color: #0c5460;
border: 1px solid #bee5eb;
display: block;
}
/* 響應式設計 */
@media (max-width: 768px) {
header {
flex-direction: column;
text-align: center;
}
.form-row {
grid-template-columns: 1fr;
}
.charts-container {
grid-template-columns: 1fr;
}
.tabs {
flex-direction: column;
}
.tab-btn {
width: 100%;
text-align: left;
}
}