-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathindex.html
More file actions
451 lines (408 loc) · 17 KB
/
Copy pathindex.html
File metadata and controls
451 lines (408 loc) · 17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Awesome RSSHub Routes - 官方 RSS 与 RSSHub 路由</title>
<meta name="description" content="实用的 RSS 订阅源目录,收录官方 RSS 与 RSSHub 路由,支持分类浏览、搜索筛选、OPML 导入和健康检查。">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<style>
.feed-card {
transition: all 0.2s ease;
}
.feed-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.category-btn.active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.copy-btn:active {
transform: scale(0.95);
}
.toast {
animation: slideIn 0.3s ease, fadeOut 0.3s ease 1.7s;
}
@keyframes slideIn {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeOut {
from { opacity: 1; }
to { opacity: 0; }
}
.gradient-text {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
<!-- Header -->
<header class="bg-white shadow-sm sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 py-4 sm:px-6 lg:px-8">
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
<div class="flex items-center gap-3">
<span class="text-3xl">🎯</span>
<div>
<h1 class="text-xl font-bold gradient-text" data-i18n="siteName">Awesome RSSHub Routes</h1>
<p class="text-sm text-gray-500" data-i18n="subtitle">官方 RSS 与 RSSHub 路由目录,支持搜索、复制和 OPML 导入</p>
</div>
</div>
<div class="flex items-center gap-3">
<div class="flex items-center gap-1 text-sm" title="Switch Language">
<button onclick="setLang('zh')" id="lang-zh" class="px-2 py-1 rounded transition font-medium text-gray-400 hover:text-gray-900">中文</button>
<button onclick="setLang('en')" id="lang-en" class="px-2 py-1 rounded transition font-medium text-gray-400 hover:text-gray-900">EN</button>
</div>
<a href="https://github.com/JackyST0/awesome-rsshub-routes" target="_blank"
class="flex items-center gap-2 px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-700 transition">
<i class="fab fa-github"></i>
<span class="hidden sm:inline">GitHub</span>
</a>
<a href="feeds.opml" download
class="flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-purple-600 to-indigo-600 text-white rounded-lg hover:opacity-90 transition">
<i class="fas fa-download"></i>
<span data-i18n="download">下载 OPML</span>
</a>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<main class="max-w-7xl mx-auto px-4 py-6 sm:px-6 lg:px-8">
<!-- Stats -->
<div class="grid grid-cols-2 sm:grid-cols-4 gap-4 mb-6">
<div class="bg-white rounded-xl p-4 shadow-sm text-center">
<div class="text-2xl font-bold text-indigo-600" id="total-feeds">0</div>
<div class="text-sm text-gray-500" data-i18n="totalFeeds">订阅源总数</div>
</div>
<div class="bg-white rounded-xl p-4 shadow-sm text-center">
<div class="text-2xl font-bold text-purple-600" id="total-categories">0</div>
<div class="text-sm text-gray-500" data-i18n="categories">分类数量</div>
</div>
<div class="bg-white rounded-xl p-4 shadow-sm text-center">
<div class="text-2xl font-bold text-green-600" id="valid-feeds">-</div>
<div class="text-sm text-gray-500" data-i18n="available">可用订阅</div>
</div>
<div class="bg-white rounded-xl p-4 shadow-sm text-center">
<div class="text-2xl font-bold text-blue-600" id="success-rate">-</div>
<div class="text-sm text-gray-500" data-i18n="successRate">成功率</div>
</div>
</div>
<!-- Search & Filter -->
<div class="bg-white rounded-xl p-4 shadow-sm mb-6">
<!-- Search -->
<div class="relative mb-4">
<i class="fas fa-search absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
<input type="text" id="search-input" data-i18n-placeholder="searchPlaceholder" placeholder="搜索订阅源名称或链接..."
class="w-full pl-10 pr-4 py-3 border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none text-gray-900 bg-white text-base">
</div>
<!-- Category Filters -->
<div class="flex gap-2 overflow-x-auto pb-2" id="category-filters">
<button class="category-btn active px-4 py-2 rounded-lg bg-gray-100 text-sm whitespace-nowrap transition" data-category="all" onclick="filterByCategory('all')">
<span data-i18n="all">全部</span>
</button>
</div>
</div>
<!-- Feed Grid -->
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4" id="feeds-grid">
<!-- Feeds will be inserted here -->
</div>
<!-- Empty State -->
<div id="empty-state" class="hidden text-center py-12">
<i class="fas fa-search text-4xl text-gray-300 mb-4"></i>
<p class="text-gray-500" data-i18n="noResults">没有找到匹配的订阅源</p>
</div>
</main>
<!-- Footer -->
<footer class="bg-white border-t mt-12">
<div class="max-w-7xl mx-auto px-4 py-6 sm:px-6 lg:px-8">
<div class="flex flex-col sm:flex-row items-center justify-between gap-4">
<p class="text-sm text-gray-500">
Made with ❤️ by <a href="https://github.com/JackyST0" class="text-indigo-600 hover:underline">JackyST0</a>
</p>
<div class="flex items-center gap-4 text-sm text-gray-500">
<span id="last-check" data-i18n-prefix="lastCheck">最近检测:-</span>
<a href="https://github.com/JackyST0/awesome-rsshub-routes/issues" class="text-indigo-600 hover:underline">
<i class="fas fa-chart-line mr-1"></i><span data-i18n="viewReport">查看状态报告</span>
</a>
</div>
</div>
</div>
</footer>
<!-- Toast -->
<div id="toast" class="fixed bottom-4 right-4 bg-gray-900 text-white px-4 py-2 rounded-lg shadow-lg hidden">
<i class="fas fa-check mr-2"></i>
<span id="toast-message">已复制到剪贴板</span>
</div>
<script>
// i18n 字典
const i18n = {
zh: {
siteName: 'Awesome RSSHub Routes',
subtitle: '官方 RSS 与 RSSHub 路由目录,支持搜索、复制和 OPML 导入',
download: '下载 OPML',
totalFeeds: '订阅源总数',
categories: '分类数量',
available: '可用订阅',
successRate: '成功率',
searchPlaceholder: '搜索订阅源名称或链接...',
all: '全部',
copyUrl: '复制链接',
noResults: '没有找到匹配的订阅源',
lastCheck: '最近检测',
viewReport: '查看状态报告',
copied: '已复制到剪贴板',
loadError: '加载订阅源失败',
noData: '暂无检测数据',
title: 'Awesome RSSHub Routes - 官方 RSS 与 RSSHub 路由'
},
en: {
siteName: 'Awesome RSSHub Routes',
subtitle: 'Official RSS feeds and RSSHub routes with search, copy, and OPML import',
download: 'Download OPML',
totalFeeds: 'Total Feeds',
categories: 'Categories',
available: 'Available',
successRate: 'Success Rate',
searchPlaceholder: 'Search feeds by name or URL...',
all: 'All',
copyUrl: 'Copy URL',
noResults: 'No matching feeds found',
lastCheck: 'Last Check',
viewReport: 'View Status Report',
copied: 'Copied to clipboard',
loadError: 'Failed to load feeds',
noData: 'No check data available',
title: 'Awesome RSSHub Routes - Official RSS and RSSHub Routes'
}
};
// 分类名翻译
const categoryNameMap = {
'AI 专题': 'AI',
'技术社区': 'Tech Communities',
'新闻资讯': 'News',
'科技媒体': 'Tech Media',
'安全资讯': 'Security',
'前端 & 设计': 'Frontend & Design',
'前端 & 设计': 'Frontend & Design',
'编程语言官方博客': 'Language Blogs',
'大厂技术博客': 'Tech Blogs',
'技术周刊': 'Tech Newsletters',
'学术论文': 'Academic Papers',
'RSS 工具更新': 'RSS Tools'
};
// 获取分类显示名
function getCategoryDisplayName(rawName) {
const stripped = rawName.replace(/^[^\s]+\s/, ''); // 去掉 emoji
if (currentLang === 'en' && categoryNameMap[stripped]) {
return categoryNameMap[stripped];
}
return stripped;
}
// 当前语言
let currentLang = localStorage.getItem('lang') || 'zh';
// 设置语言
function setLang(lang) {
currentLang = lang;
localStorage.setItem('lang', currentLang);
applyLang();
renderCategoryButtons();
renderFeeds();
}
// 切换语言(兼容)
function toggleLang() {
setLang(currentLang === 'zh' ? 'en' : 'zh');
}
// 应用语言
function applyLang() {
const t = i18n[currentLang];
// 更新页面标题
document.title = t.title;
document.documentElement.lang = currentLang === 'zh' ? 'zh-CN' : 'en';
// 更新语言按钮高亮
document.getElementById('lang-zh').className = currentLang === 'zh'
? 'px-2 py-1 rounded transition font-medium text-gray-900'
: 'px-2 py-1 rounded transition font-medium text-gray-400 hover:text-gray-900';
document.getElementById('lang-en').className = currentLang === 'en'
? 'px-2 py-1 rounded transition font-medium text-gray-900'
: 'px-2 py-1 rounded transition font-medium text-gray-400 hover:text-gray-900';
// 更新所有 data-i18n 元素
document.querySelectorAll('[data-i18n]').forEach(el => {
const key = el.getAttribute('data-i18n');
if (t[key]) el.textContent = t[key];
});
// 更新 placeholder
document.querySelectorAll('[data-i18n-placeholder]').forEach(el => {
const key = el.getAttribute('data-i18n-placeholder');
if (t[key]) el.placeholder = t[key];
});
// 更新 last-check(保留时间部分)
const lastCheckEl = document.getElementById('last-check');
const checkTime = lastCheckEl.dataset.checkTime || '-';
lastCheckEl.textContent = `${t.lastCheck}:${checkTime}`;
}
// 重新渲染分类按钮文字
function renderCategoryButtons() {
document.querySelectorAll('.category-btn').forEach(btn => {
const cat = btn.dataset.category;
if (cat === 'all') return; // "全部/All" 由 data-i18n 处理
btn.textContent = getCategoryDisplayName(cat);
});
}
// 全局数据
let allFeeds = [];
let categories = [];
let currentCategory = 'all';
let searchQuery = '';
// 解析 OPML
async function loadFeeds() {
try {
const response = await fetch('feeds.opml');
const text = await response.text();
const parser = new DOMParser();
const xml = parser.parseFromString(text, 'text/xml');
const categoryOutlines = xml.querySelectorAll('body > outline');
categoryOutlines.forEach(cat => {
const categoryName = cat.getAttribute('text') || cat.getAttribute('title');
categories.push(categoryName);
const feeds = cat.querySelectorAll('outline[xmlUrl]');
feeds.forEach(feed => {
allFeeds.push({
name: feed.getAttribute('text') || feed.getAttribute('title'),
url: feed.getAttribute('xmlUrl'),
category: categoryName
});
});
});
updateStats();
renderCategories();
renderFeeds();
loadFeedStatus();
} catch (error) {
console.error(i18n[currentLang].loadError, error);
}
}
// 加载检测状态
async function loadFeedStatus() {
try {
const response = await fetch('https://raw.githubusercontent.com/JackyST0/awesome-rsshub-routes/main/feed-status.json');
if (response.ok) {
const status = await response.json();
document.getElementById('valid-feeds').textContent = status.valid;
document.getElementById('success-rate').textContent = status.successRate;
const lastCheckEl = document.getElementById('last-check');
lastCheckEl.dataset.checkTime = status.checkTime;
lastCheckEl.textContent = `${i18n[currentLang].lastCheck}:${status.checkTime}`;
}
} catch (error) {
console.log(i18n[currentLang].noData);
}
}
// 更新统计
function updateStats() {
document.getElementById('total-feeds').textContent = allFeeds.length;
document.getElementById('total-categories').textContent = categories.length;
}
// 渲染分类按钮
function renderCategories() {
const container = document.getElementById('category-filters');
categories.forEach(cat => {
const btn = document.createElement('button');
btn.className = 'category-btn px-4 py-2 rounded-lg bg-gray-100 text-sm whitespace-nowrap transition';
btn.dataset.category = cat;
btn.textContent = cat.replace(/^[^\s]+\s/, ''); // 去掉 emoji
btn.onclick = () => filterByCategory(cat);
container.appendChild(btn);
});
}
// 渲染订阅源卡片
function renderFeeds() {
const container = document.getElementById('feeds-grid');
const emptyState = document.getElementById('empty-state');
const t = i18n[currentLang];
let filteredFeeds = allFeeds;
// 按分类筛选
if (currentCategory !== 'all') {
filteredFeeds = filteredFeeds.filter(f => f.category === currentCategory);
}
// 按搜索词筛选
if (searchQuery) {
const query = searchQuery.toLowerCase();
filteredFeeds = filteredFeeds.filter(f =>
f.name.toLowerCase().includes(query) ||
f.url.toLowerCase().includes(query) ||
f.category.toLowerCase().includes(query)
);
}
if (filteredFeeds.length === 0) {
container.innerHTML = '';
emptyState.classList.remove('hidden');
return;
}
emptyState.classList.add('hidden');
container.innerHTML = filteredFeeds.map(feed => `
<div class="feed-card bg-white rounded-xl p-4 shadow-sm border border-gray-100">
<div class="flex items-start justify-between gap-2 mb-2">
<h3 class="font-medium text-gray-900 flex-1">${escapeHtml(feed.name)}</h3>
<span class="text-xs px-2 py-1 bg-indigo-50 text-indigo-600 rounded-full whitespace-nowrap">
${escapeHtml(getCategoryDisplayName(feed.category))}
</span>
</div>
<p class="text-xs text-gray-400 truncate mb-3" title="${escapeHtml(feed.url)}">${escapeHtml(feed.url)}</p>
<div class="flex gap-2">
<button onclick="copyUrl('${escapeHtml(feed.url)}')"
class="copy-btn flex-1 px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-sm transition">
<i class="fas fa-copy mr-1"></i>${t.copyUrl}
</button>
<a href="${escapeHtml(feed.url)}" target="_blank"
class="px-3 py-1.5 bg-indigo-100 hover:bg-indigo-200 text-indigo-700 rounded-lg text-sm transition">
<i class="fas fa-external-link-alt"></i>
</a>
</div>
</div>
`).join('');
}
// 分类筛选
function filterByCategory(category) {
currentCategory = category;
// 更新按钮状态
document.querySelectorAll('.category-btn').forEach(btn => {
btn.classList.toggle('active', btn.dataset.category === category);
});
renderFeeds();
}
// 复制链接
function copyUrl(url) {
navigator.clipboard.writeText(url).then(() => {
showToast(i18n[currentLang].copied);
});
}
// 显示提示
function showToast(message) {
const toast = document.getElementById('toast');
document.getElementById('toast-message').textContent = message;
toast.classList.remove('hidden');
setTimeout(() => toast.classList.add('hidden'), 2000);
}
// HTML 转义
function escapeHtml(text) {
const div = document.createElement('div');
div.textContent = text;
return div.innerHTML;
}
// 搜索
document.getElementById('search-input').addEventListener('input', (e) => {
searchQuery = e.target.value;
renderFeeds();
});
// 初始化
applyLang();
loadFeeds();
</script>
</body>
</html>