mark-favorites.jsā¢4.08 kB
// Mark favorite blogs based on user's technical interests
// Interests: AI, ML, Python, Software Architecture, Cloud, DevOps, Modern Web, Distributed Systems
require('dotenv').config();
const { AppDataSource } = require('./dist/config/database');
const { Feed } = require('./dist/entities/Feed');
// Blogs highly relevant to the user's profile
const FAVORITE_KEYWORDS = [
// AI & ML Companies
'openai', 'anthropic', 'hugging', 'deepmind', 'google ai', 'meta ai',
// ML Frameworks & Tools
'pytorch', 'tensorflow', 'keras', 'databricks', 'mlops', 'kaggle',
// Python Ecosystem
'python', 'django', 'flask', 'fastapi', 'pydantic',
// Cloud Platforms
'aws', 'google cloud', 'azure', 'gcp', 'cloudflare', 'vercel', 'netlify',
// DevOps & Infrastructure
'kubernetes', 'docker', 'terraform', 'pulumi', 'hashicorp', 'datadog',
// Software Architecture
'microservices', 'distributed', 'architecture', 'system design', 'scalability',
// Modern Web & Frameworks
'react', 'next.js', 'typescript', 'node.js', 'graphql', 'remix',
// Top Tech Companies (Engineering Blogs)
'netflix', 'uber', 'airbnb', 'stripe', 'shopify', 'github', 'gitlab',
'facebook', 'meta', 'google', 'microsoft', 'amazon', 'apple',
// Database & Data
'postgres', 'mongodb', 'redis', 'elasticsearch', 'clickhouse', 'snowflake',
// Observability & Monitoring
'grafana', 'prometheus', 'datadog', 'new relic', 'sentry',
// Platform Engineering
'platform engineering', 'internal developer', 'backstage',
// Specific High-Quality Blogs
'martin fowler', 'thoughtworks', 'etsy', 'spotify', 'linkedin',
'slack', 'dropbox', 'pinterest', 'twitter', 'reddit', 'discord'
];
async function markFavorites() {
console.log('Analyzing and marking favorite blogs...\n');
try {
// Initialize database
if (!AppDataSource.isInitialized) {
await AppDataSource.initialize();
}
const feedRepository = AppDataSource.getRepository(Feed);
const allFeeds = await feedRepository.find();
console.log(`Found ${allFeeds.length} total blogs\n`);
const favorites = [];
const matched = [];
for (const feed of allFeeds) {
const searchText = `${feed.title} ${feed.category} ${feed.url}`.toLowerCase();
// Check if blog matches any favorite keywords
const matchedKeywords = FAVORITE_KEYWORDS.filter(keyword =>
searchText.includes(keyword.toLowerCase())
);
if (matchedKeywords.length > 0) {
feed.isFavorite = true;
await feedRepository.save(feed);
favorites.push(feed);
matched.push({
title: feed.title,
category: feed.category,
matches: matchedKeywords
});
}
}
console.log(`ā
Marked ${favorites.length} blogs as favorites!\n`);
// Group by category for better overview
const byCategory = {};
favorites.forEach(feed => {
if (!byCategory[feed.category]) {
byCategory[feed.category] = [];
}
byCategory[feed.category].push(feed.title);
});
console.log('š Your Favorite Blogs by Category:\n');
Object.keys(byCategory).sort().forEach(category => {
console.log(`\n${category}:`);
byCategory[category].forEach(title => {
console.log(` - ${title}`);
});
});
console.log('\n\nšÆ Top Matches (by relevance):\n');
matched
.sort((a, b) => b.matches.length - a.matches.length)
.slice(0, 20)
.forEach((item, i) => {
console.log(`${i+1}. ${item.title}`);
console.log(` Category: ${item.category}`);
console.log(` Matches: ${item.matches.join(', ')}`);
console.log('');
});
console.log('\nš” Now you can use:');
console.log('- get_content with prioritizeFavoriteBlogs=true');
console.log('- get_content with favoriteBlogsOnly=true');
console.log('- search_articles with your favorite blogs prioritized\n');
await AppDataSource.destroy();
process.exit(0);
} catch (error) {
console.error('ā Error:', error);
process.exit(1);
}
}
markFavorites();