Spaces:
Paused
Paused
Savestate: Implement Perplexity-style multi-category RSS ingestion for News Discover feed (BUILD 1.6.4)
Browse files- dynamischer Name.txt +2 -18
- server/news-service.js +53 -27
dynamischer Name.txt
CHANGED
|
@@ -1,15 +1,11 @@
|
|
| 1 |
farbverlauf
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
Database Password: #8BA2V*d4xtPzzv
|
| 6 |
|
| 7 |
-
Enter
|
| 8 |
-
|
| 9 |
meine Themen (Entdecken Sektion)
|
| 10 |
|
| 11 |
-
Account system
|
| 12 |
-
|
| 13 |
wissensammeln --> persönliche News
|
| 14 |
|
| 15 |
open router: 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
|
|
@@ -37,26 +33,16 @@ Scan = direkt Vocabeln eingetragen
|
|
| 37 |
|
| 38 |
Erweitertes Denken (✅)
|
| 39 |
|
| 40 |
-
Text to speech
|
| 41 |
-
|
| 42 |
In obsidian als bild oder zu text umgewandelt
|
| 43 |
|
| 44 |
Theme White mode fixen
|
| 45 |
|
| 46 |
-
Schreibprofil + Feedback
|
| 47 |
-
|
| 48 |
-
Kopieren perfekt für notizen ohne "*" (✅)
|
| 49 |
-
|
| 50 |
-
Deep Research Ladebildschrim
|
| 51 |
-
|
| 52 |
-
Makieren + Nachfrage stellen (✅)
|
| 53 |
|
| 54 |
Startverhalten fixen
|
| 55 |
|
| 56 |
Ordner Kontext
|
| 57 |
|
| 58 |
-
Iserv Vortäuschen (✅)
|
| 59 |
-
|
| 60 |
Chat Löschen fixen (✅)
|
| 61 |
|
| 62 |
In Suche auf Zitat klicken = Zum zitat navigiert (✅)
|
|
@@ -78,6 +64,4 @@ Vokaveltrainer
|
|
| 78 |
|
| 79 |
Ganze Buch implementation
|
| 80 |
|
| 81 |
-
News sektion
|
| 82 |
-
|
| 83 |
Kalender mit Klausurplan sync
|
|
|
|
| 1 |
farbverlauf
|
| 2 |
|
| 3 |
+
untis
|
| 4 |
|
| 5 |
Database Password: #8BA2V*d4xtPzzv
|
| 6 |
|
|
|
|
|
|
|
| 7 |
meine Themen (Entdecken Sektion)
|
| 8 |
|
|
|
|
|
|
|
| 9 |
wissensammeln --> persönliche News
|
| 10 |
|
| 11 |
open router: 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
|
|
|
|
| 33 |
|
| 34 |
Erweitertes Denken (✅)
|
| 35 |
|
|
|
|
|
|
|
| 36 |
In obsidian als bild oder zu text umgewandelt
|
| 37 |
|
| 38 |
Theme White mode fixen
|
| 39 |
|
| 40 |
+
Schreibprofil + Feedback
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
Startverhalten fixen
|
| 43 |
|
| 44 |
Ordner Kontext
|
| 45 |
|
|
|
|
|
|
|
| 46 |
Chat Löschen fixen (✅)
|
| 47 |
|
| 48 |
In Suche auf Zitat klicken = Zum zitat navigiert (✅)
|
|
|
|
| 64 |
|
| 65 |
Ganze Buch implementation
|
| 66 |
|
|
|
|
|
|
|
| 67 |
Kalender mit Klausurplan sync
|
server/news-service.js
CHANGED
|
@@ -147,7 +147,45 @@ function enrichUserTopics(userTopics) {
|
|
| 147 |
async function detectTrends() {
|
| 148 |
const trends = [];
|
| 149 |
|
| 150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
try {
|
| 152 |
const url = 'https://trends.google.de/trending/rss?geo=DE';
|
| 153 |
const res = await fetch(url);
|
|
@@ -155,7 +193,7 @@ async function detectTrends() {
|
|
| 155 |
const $ = cheerio.load(xml, { xmlMode: true });
|
| 156 |
|
| 157 |
$('item').each((i, el) => {
|
| 158 |
-
if (i >=
|
| 159 |
const title = $(el).find('title').text().trim();
|
| 160 |
const traffic = $(el).find('ht\\:approx_traffic, approx_traffic').text();
|
| 161 |
const newsItems = [];
|
|
@@ -163,38 +201,26 @@ async function detectTrends() {
|
|
| 163 |
newsItems.push($(newsEl).text());
|
| 164 |
});
|
| 165 |
|
| 166 |
-
trends.
|
| 167 |
-
topic: title, traffic, relatedHeadlines: newsItems.slice(0, 3),
|
| 168 |
-
source: 'google_trends'
|
| 169 |
-
});
|
| 170 |
-
});
|
| 171 |
-
} catch (e) {
|
| 172 |
-
console.error('[TrendDetector] Google Trends RSS failed:', e.message);
|
| 173 |
-
}
|
| 174 |
-
|
| 175 |
-
// === Quelle 2: Google News RSS Top-Headlines (DE) ===
|
| 176 |
-
try {
|
| 177 |
-
const url = 'https://news.google.com/rss?hl=de&gl=DE&ceid=DE:de';
|
| 178 |
-
const res = await fetch(url);
|
| 179 |
-
const xml = await res.text();
|
| 180 |
-
const $ = cheerio.load(xml, { xmlMode: true });
|
| 181 |
-
|
| 182 |
-
$('item').each((i, el) => {
|
| 183 |
-
if (i >= 5) return;
|
| 184 |
-
const title = $(el).find('title').text().trim();
|
| 185 |
-
const cleanTitle = title.replace(/\s*-\s*[^-]+$/, '').trim();
|
| 186 |
-
|
| 187 |
-
if (!trends.some(t => jaccardSimilarity(t.topic, cleanTitle) > 0.5)) {
|
| 188 |
trends.push({
|
| 189 |
-
topic:
|
| 190 |
-
source: '
|
|
|
|
| 191 |
});
|
| 192 |
}
|
| 193 |
});
|
| 194 |
} catch (e) {
|
| 195 |
-
console.error('[TrendDetector] Google
|
| 196 |
}
|
| 197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
return trends;
|
| 199 |
}
|
| 200 |
|
|
|
|
| 147 |
async function detectTrends() {
|
| 148 |
const trends = [];
|
| 149 |
|
| 150 |
+
const newsFeeds = [
|
| 151 |
+
{ url: 'https://news.google.com/rss?hl=de&gl=DE&ceid=DE:de', source: 'Top-News', limit: 4 },
|
| 152 |
+
{ url: 'https://news.google.com/rss/headlines/section/topic/WORLD?hl=de&gl=DE&ceid=DE:de', source: 'Welt', limit: 3 },
|
| 153 |
+
{ url: 'https://news.google.com/rss/headlines/section/topic/TECHNOLOGY?hl=de&gl=DE&ceid=DE:de', source: 'Technologie', limit: 3 },
|
| 154 |
+
{ url: 'https://news.google.com/rss/headlines/section/topic/SCIENCE?hl=de&gl=DE&ceid=DE:de', source: 'Wissenschaft', limit: 3 },
|
| 155 |
+
{ url: 'https://news.google.com/rss/headlines/section/topic/BUSINESS?hl=de&gl=DE&ceid=DE:de', source: 'Wirtschaft', limit: 2 },
|
| 156 |
+
{ url: 'https://news.google.com/rss/headlines/section/topic/HEALTH?hl=de&gl=DE&ceid=DE:de', source: 'Gesundheit', limit: 2 },
|
| 157 |
+
{ url: 'https://news.google.com/rss/headlines/section/topic/ENTERTAINMENT?hl=de&gl=DE&ceid=DE:de', source: 'Unterhaltung', limit: 2 },
|
| 158 |
+
{ url: 'https://news.google.com/rss/headlines/section/topic/SPORTS?hl=de&gl=DE&ceid=DE:de', source: 'Sport', limit: 2 }
|
| 159 |
+
];
|
| 160 |
+
|
| 161 |
+
// 1. Fetch category specific Google News RSS
|
| 162 |
+
for (const feed of newsFeeds) {
|
| 163 |
+
try {
|
| 164 |
+
const res = await fetch(feed.url);
|
| 165 |
+
const xml = await res.text();
|
| 166 |
+
const $ = cheerio.load(xml, { xmlMode: true });
|
| 167 |
+
|
| 168 |
+
$('item').each((i, el) => {
|
| 169 |
+
if (i >= feed.limit) return;
|
| 170 |
+
const title = $(el).find('title').text().trim();
|
| 171 |
+
const cleanTitle = title.replace(/\s*-\s*[^-]+$/, '').trim();
|
| 172 |
+
|
| 173 |
+
if (!trends.some(t => jaccardSimilarity(t.topic, cleanTitle) > 0.6)) {
|
| 174 |
+
trends.push({
|
| 175 |
+
topic: cleanTitle,
|
| 176 |
+
traffic: 'high',
|
| 177 |
+
relatedHeadlines: [],
|
| 178 |
+
source: feed.source,
|
| 179 |
+
rank: i // 0 is top story in this category
|
| 180 |
+
});
|
| 181 |
+
}
|
| 182 |
+
});
|
| 183 |
+
} catch (e) {
|
| 184 |
+
console.error(`[TrendDetector] RSS failed for ${feed.source}:`, e.message);
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
// 2. Fetch Google Trends RSS (DE)
|
| 189 |
try {
|
| 190 |
const url = 'https://trends.google.de/trending/rss?geo=DE';
|
| 191 |
const res = await fetch(url);
|
|
|
|
| 193 |
const $ = cheerio.load(xml, { xmlMode: true });
|
| 194 |
|
| 195 |
$('item').each((i, el) => {
|
| 196 |
+
if (i >= 5) return;
|
| 197 |
const title = $(el).find('title').text().trim();
|
| 198 |
const traffic = $(el).find('ht\\:approx_traffic, approx_traffic').text();
|
| 199 |
const newsItems = [];
|
|
|
|
| 201 |
newsItems.push($(newsEl).text());
|
| 202 |
});
|
| 203 |
|
| 204 |
+
if (!trends.some(t => jaccardSimilarity(t.topic, title) > 0.6)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
trends.push({
|
| 206 |
+
topic: title, traffic, relatedHeadlines: newsItems.slice(0, 3),
|
| 207 |
+
source: 'Google Trends',
|
| 208 |
+
rank: i
|
| 209 |
});
|
| 210 |
}
|
| 211 |
});
|
| 212 |
} catch (e) {
|
| 213 |
+
console.error('[TrendDetector] Google Trends RSS failed:', e.message);
|
| 214 |
}
|
| 215 |
|
| 216 |
+
// 3. Interleave/Sort trends so we get the #1 from each category first, then #2, etc.
|
| 217 |
+
trends.sort((a, b) => {
|
| 218 |
+
// If ranks are different, sort by rank (so all rank 0 come first)
|
| 219 |
+
if (a.rank !== b.rank) return a.rank - b.rank;
|
| 220 |
+
// Otherwise shuffle slightly to mix categories
|
| 221 |
+
return Math.random() - 0.5;
|
| 222 |
+
});
|
| 223 |
+
|
| 224 |
return trends;
|
| 225 |
}
|
| 226 |
|