sondakika 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +102 -0
- package/package.json +9 -2
- package/AGENTS.md +0 -184
- package/assets/icon.ico +0 -0
- package/assets/icon.png +0 -0
- package/assets/icon.svg +0 -21
- package/build-index.js +0 -1137
- package/build.js +0 -1117
- package/create-multi-icon.js +0 -47
- package/fix-all-issues.js +0 -55
- package/fix-all.js +0 -33
- package/fix-comprehensive.js +0 -52
- package/fix-final.js +0 -54
- package/fix-icon.js +0 -32
- package/fix-index.js +0 -60
- package/fix-syntax.js +0 -53
- package/fix-unicode.js +0 -66
- package/generate-index.js +0 -1136
- package/generate_main.js +0 -338
- package/index.js +0 -438
- package/src/main/article-preload.js +0 -12
- package/src/main/main.js.new +0 -20
- package/src/main/preload.js +0 -17
- package/src/renderer/article-view.html +0 -649
- package/src/renderer/index.html +0 -1258
package/cli.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const blessed = require('blessed');
|
|
4
|
+
const RssParser = require('rss-parser');
|
|
5
|
+
const parser = new RssParser();
|
|
6
|
+
|
|
7
|
+
const sources = {
|
|
8
|
+
cumhuriyet: { name: 'Cumhuriyet', url: 'https://www.cumhuriyet.com.tr/rss/son_dakika.xml', type: 'breaking' },
|
|
9
|
+
trt: { name: 'TRT Haber', url: 'https://www.trthaber.com/son-dakika.rss', type: 'breaking' },
|
|
10
|
+
mynet: { name: 'Mynet', url: 'https://www.mynet.com/rss/son-dakika/', type: 'breaking' },
|
|
11
|
+
sabah: { name: 'Sabah', url: 'https://www.sabah.com.tr/rss/son-dakika.xml', type: 'news' },
|
|
12
|
+
star: { name: 'Star', url: 'https://www.star.com.tr/rss/son-dakika.xml', type: 'news' },
|
|
13
|
+
vatan: { name: 'Gazete Vatan', url: 'https://www.gazetevatan.com/rss/son-dakika.xml', type: 'news' },
|
|
14
|
+
haberturk: { name: 'Habertürk', url: 'https://www.haberturk.com/rss/son-dakika.xml', type: 'news' },
|
|
15
|
+
cnnturk: { name: 'CNN Türk', url: 'https://www.cnnturk.com/feed/rss', type: 'news' },
|
|
16
|
+
yenisafak: { name: 'Yeni Şafak', url: 'https://www.yenisafak.com/rss/son-dakika.xml', type: 'news' },
|
|
17
|
+
aa: { name: 'Anadolu Ajansı', url: 'https://www.aa.com.tr/tr/rss/default?cat=guncel', type: 'news' }
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const args = process.argv.slice(2);
|
|
21
|
+
const sourceArg = args[0];
|
|
22
|
+
const countArg = parseInt(args[1]) || 10;
|
|
23
|
+
|
|
24
|
+
if (!sourceArg || !sources[sourceArg]) {
|
|
25
|
+
console.log(`
|
|
26
|
+
📰 Sondakika - Türkçe Haber Okuyucu
|
|
27
|
+
|
|
28
|
+
Kullanım:
|
|
29
|
+
sondakika <kaynak> [adet]
|
|
30
|
+
|
|
31
|
+
Mevcut Kaynaklar:
|
|
32
|
+
Son Dakika:
|
|
33
|
+
cumhuriyet - Cumhuriyet
|
|
34
|
+
trt - TRT Haber
|
|
35
|
+
mynet - Mynet
|
|
36
|
+
|
|
37
|
+
Haberler:
|
|
38
|
+
sabah - Sabah
|
|
39
|
+
star - Star
|
|
40
|
+
vatan - Gazete Vatan
|
|
41
|
+
haberturk - Habertürk
|
|
42
|
+
cnnturk - CNN Türk
|
|
43
|
+
yenisafak - Yeni Şafak
|
|
44
|
+
aa - Anadolu Ajansı
|
|
45
|
+
|
|
46
|
+
Örnekler:
|
|
47
|
+
sondakika trt
|
|
48
|
+
sondakika cumhuriyet 20
|
|
49
|
+
sondakika haberturk 5
|
|
50
|
+
`);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const source = sources[sourceArg];
|
|
55
|
+
|
|
56
|
+
async function fetchNews() {
|
|
57
|
+
try {
|
|
58
|
+
const feed = await parser.parseURL(source.url);
|
|
59
|
+
const items = feed.items.slice(0, countArg);
|
|
60
|
+
|
|
61
|
+
const screen = blessed.screen({ smartCSR: true });
|
|
62
|
+
const box = blessed.box({
|
|
63
|
+
top: 0,
|
|
64
|
+
left: 0,
|
|
65
|
+
width: '100%',
|
|
66
|
+
height: '100%',
|
|
67
|
+
content: `{center}📰 ${source.name} - Son Dakika{/center}`,
|
|
68
|
+
tags: true,
|
|
69
|
+
border: { type: 'line' },
|
|
70
|
+
style: { border: { fg: 'cyan' } }
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
screen.append(box);
|
|
74
|
+
screen.render();
|
|
75
|
+
screen.destroy();
|
|
76
|
+
screen.program.destroy();
|
|
77
|
+
|
|
78
|
+
console.log(`\n📰 ══════════════════════════════════════════════════`);
|
|
79
|
+
console.log(` ${source.name} - Son ${countArg} Haber`);
|
|
80
|
+
console.log(` ══════════════════════════════════════════════════\n`);
|
|
81
|
+
|
|
82
|
+
items.forEach((item, index) => {
|
|
83
|
+
const date = item.pubDate ? new Date(item.pubDate).toLocaleString('tr-TR') : '';
|
|
84
|
+
console.log(` ┌─ ${index + 1}. ${item.title}`);
|
|
85
|
+
console.log(` │`);
|
|
86
|
+
console.log(` │ 📅 ${date}`);
|
|
87
|
+
console.log(` │`);
|
|
88
|
+
if (item.contentSnippet) {
|
|
89
|
+
const snippet = item.contentSnippet.substring(0, 100).replace(/\n/g, ' ');
|
|
90
|
+
console.log(` │ ${snippet}...`);
|
|
91
|
+
}
|
|
92
|
+
console.log(` └─────────────────────────────────────────────────────────────────────`);
|
|
93
|
+
console.log(` 🔗 ${item.link}\n`);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error('Haberler alınırken hata oluştu:', error.message);
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
fetchNews();
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sondakika",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "Turkish news reader: CLI tool for terminal + Electron-based desktop app",
|
|
5
5
|
"main": "src/main/main.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"sondakika": "./cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"cli.js"
|
|
11
|
+
],
|
|
12
|
+
"keywords": ["news", "rss", "turkish", "cli", "terminal", "electron"],
|
|
6
13
|
"author": {
|
|
7
14
|
"name": "Sedat Ergoz",
|
|
8
15
|
"email": "sedatergoz@gmail.com",
|
package/AGENTS.md
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
# AGENTS.md - News CLI Project
|
|
2
|
-
|
|
3
|
-
## Project Overview
|
|
4
|
-
|
|
5
|
-
This is a simple Node.js CLI application that fetches and displays news from RSS feeds. It uses `rss-parser` to parse RSS feeds and displays news in a styled terminal output.
|
|
6
|
-
|
|
7
|
-
## Project Structure
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
sondakika/
|
|
11
|
-
├── index.js # Main CLI entry point
|
|
12
|
-
├── package.json # Project dependencies and scripts
|
|
13
|
-
└── AGENTS.md # This file - guidelines for AI agents
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Build & Run Commands
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
# Run the CLI
|
|
20
|
-
npm start # Runs: node index.js
|
|
21
|
-
node index.js # Direct execution
|
|
22
|
-
|
|
23
|
-
# With arguments
|
|
24
|
-
node index.js ntv # Show NTV news (default 10 items)
|
|
25
|
-
node index.js ntv 15 # Show 15 NTV news items
|
|
26
|
-
node index.js haberturk 5 # Show Habertürk 5 news
|
|
27
|
-
|
|
28
|
-
# Global installation (for 'sondakika' command)
|
|
29
|
-
npm link
|
|
30
|
-
sondakika ntv 15 # Run as global command
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Adding New RSS Sources
|
|
34
|
-
|
|
35
|
-
To add a new news source, edit `index.js` and add to the `sources` object:
|
|
36
|
-
|
|
37
|
-
```javascript
|
|
38
|
-
const sources = {
|
|
39
|
-
ntv: 'https://www.ntv.com.tr/son-dakika.rss',
|
|
40
|
-
// ...
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const sourceInfo = {
|
|
44
|
-
ntv: { name: 'NTV', isSondakika: true }, // isSondakika: true for breaking news
|
|
45
|
-
// ...
|
|
46
|
-
};
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Then run with:
|
|
50
|
-
```bash
|
|
51
|
-
node index.js bbc
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Available News Sources
|
|
55
|
-
|
|
56
|
-
### Son Dakika (Breaking News)
|
|
57
|
-
| Key | Name | Description |
|
|
58
|
-
|-----|------|-------------|
|
|
59
|
-
| ntv | NTV (Son Dakika) | NTV breaking news |
|
|
60
|
-
| cumhuriyet | Cumhuriyet | Cumhuriyet breaking news |
|
|
61
|
-
| trt | TRT Haber | TRT breaking news |
|
|
62
|
-
| mynet | Mynet | Mynet breaking news |
|
|
63
|
-
|
|
64
|
-
### General News
|
|
65
|
-
| Key | Name | Description |
|
|
66
|
-
|-----|------|-------------|
|
|
67
|
-
| sabah | Sabah | Sabah newspaper |
|
|
68
|
-
| star | Star | Star newspaper |
|
|
69
|
-
| vatan | Gazete Vatan | Vatan newspaper |
|
|
70
|
-
| haberturk | Habertürk | Habertürk news |
|
|
71
|
-
| cnnturk | CNN Türk | CNN Türk news |
|
|
72
|
-
| yenisafak | Yeni Şafak | Yeni Şafak newspaper |
|
|
73
|
-
| aa | Anadolu Ajansı | Anadolu Agency (English) |
|
|
74
|
-
|
|
75
|
-
## No Test/Lint Commands
|
|
76
|
-
|
|
77
|
-
This project does not currently have:
|
|
78
|
-
- Unit tests
|
|
79
|
-
- Linting configuration
|
|
80
|
-
- TypeScript
|
|
81
|
-
- CI/CD pipelines
|
|
82
|
-
|
|
83
|
-
If you add tests, use:
|
|
84
|
-
```bash
|
|
85
|
-
npm test # Run tests
|
|
86
|
-
npm run lint # Run ESLint (if configured)
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Code Style Guidelines
|
|
90
|
-
|
|
91
|
-
### General Principles
|
|
92
|
-
- Keep the codebase simple and minimal
|
|
93
|
-
- Use vanilla JavaScript (no TypeScript for this project)
|
|
94
|
-
- Avoid unnecessary dependencies
|
|
95
|
-
- Focus on readability and maintainability
|
|
96
|
-
|
|
97
|
-
### File Structure
|
|
98
|
-
- `index.js` - Main entry point (single file application)
|
|
99
|
-
- `package.json` - Project configuration
|
|
100
|
-
|
|
101
|
-
### Naming Conventions
|
|
102
|
-
- **Variables/Functions**: camelCase (e.g., `fetchNews`, `wrapText`)
|
|
103
|
-
- **Constants**: UPPER_SNAKE_CASE if truly constant (e.g., `MAX_WIDTH`)
|
|
104
|
-
- **Files**: lowercase with hyphens (kebab-case)
|
|
105
|
-
|
|
106
|
-
### Code Style
|
|
107
|
-
- Use **2 spaces** for indentation
|
|
108
|
-
- **No semicolons** at end of statements (optional, but consistent with project)
|
|
109
|
-
- Use template literals (backticks) for string interpolation
|
|
110
|
-
- Use arrow functions for callbacks
|
|
111
|
-
- Prefer `const` over `let`, avoid `var`
|
|
112
|
-
|
|
113
|
-
### Imports
|
|
114
|
-
```javascript
|
|
115
|
-
// Direct require for Node built-ins
|
|
116
|
-
const path = require('path');
|
|
117
|
-
|
|
118
|
-
// Third-party packages
|
|
119
|
-
const Parser = require('rss-parser');
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Functions
|
|
123
|
-
- Keep functions small and focused
|
|
124
|
-
- Use descriptive names
|
|
125
|
-
- Add JSDoc comments for exported functions
|
|
126
|
-
|
|
127
|
-
```javascript
|
|
128
|
-
/**
|
|
129
|
-
* Wraps text to specified width for terminal display
|
|
130
|
-
* @param {string} text - Text to wrap
|
|
131
|
-
* @param {number} width - Maximum line width
|
|
132
|
-
* @returns {string[]} Array of wrapped lines
|
|
133
|
-
*/
|
|
134
|
-
function wrapText(text, width = 68) { ... }
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Error Handling
|
|
138
|
-
- Use try-catch for async operations
|
|
139
|
-
- Display user-friendly error messages
|
|
140
|
-
- Exit with non-zero code on errors: `process.exit(1)`
|
|
141
|
-
|
|
142
|
-
```javascript
|
|
143
|
-
try {
|
|
144
|
-
const feed = await parser.parseURL(url);
|
|
145
|
-
} catch (err) {
|
|
146
|
-
console.error('Error fetching news:', err.message);
|
|
147
|
-
process.exit(1);
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### CLI Output
|
|
152
|
-
- Use Unicode characters for borders (┌─┐│└┘)
|
|
153
|
-
- Support clickable URLs via ANSI escape codes (iTerm2/Windows Terminal)
|
|
154
|
-
- Wrap long text to fit terminal width (default: 68 chars)
|
|
155
|
-
- Add emoji for visual appeal (📰, 🔗)
|
|
156
|
-
- Add separator lines between news items for clarity
|
|
157
|
-
|
|
158
|
-
### Dependencies
|
|
159
|
-
- Keep dependencies minimal
|
|
160
|
-
- Use well-maintained packages:
|
|
161
|
-
- `rss-parser` - RSS feed parsing
|
|
162
|
-
- `cli-table3` - Table formatting (if needed)
|
|
163
|
-
|
|
164
|
-
## Dependencies
|
|
165
|
-
|
|
166
|
-
Current dependencies (from package.json):
|
|
167
|
-
```json
|
|
168
|
-
{
|
|
169
|
-
"rss-parser": "^3.13.0",
|
|
170
|
-
"cli-table3": "^0.6.5"
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
## Future Improvements (for agents)
|
|
175
|
-
|
|
176
|
-
If adding features, consider:
|
|
177
|
-
1. Adding unit tests with Jest or Mocha
|
|
178
|
-
2. Adding ESLint for code quality
|
|
179
|
-
3. Supporting multiple RSS sources beyond NTV
|
|
180
|
-
4. Adding configuration file for sources
|
|
181
|
-
5. Adding caching to reduce network calls
|
|
182
|
-
6. Adding date/time formatting for news items
|
|
183
|
-
7. Adding color output for different news categories
|
|
184
|
-
8. Adding pagination for large result sets
|
package/assets/icon.ico
DELETED
|
Binary file
|
package/assets/icon.png
DELETED
|
Binary file
|
package/assets/icon.svg
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
-
<stop offset="0%" style="stop-color:#1a1a2e;stop-opacity:1" />
|
|
5
|
-
<stop offset="100%" style="stop-color:#16213e;stop-opacity:1" />
|
|
6
|
-
</linearGradient>
|
|
7
|
-
</defs>
|
|
8
|
-
<rect width="256" height="256" rx="40" fill="url(#bg)"/>
|
|
9
|
-
<rect x="48" y="40" width="160" height="176" rx="8" fill="#0f3460"/>
|
|
10
|
-
<rect x="56" y="48" width="144" height="160" rx="4" fill="white"/>
|
|
11
|
-
<line x1="56" y1="75" x2="200" y2="75" stroke="#e94560" stroke-width="3"/>
|
|
12
|
-
<rect x="68" y="85" width="60" height="8" rx="2" fill="#1a1a2e"/>
|
|
13
|
-
<rect x="68" y="100" width="80" height="6" rx="2" fill="#ccc"/>
|
|
14
|
-
<rect x="68" y="112" width="70" height="6" rx="2" fill="#ccc"/>
|
|
15
|
-
<rect x="68" y="124" width="75" height="6" rx="2" fill="#ccc"/>
|
|
16
|
-
<rect x="68" y="140" width="60" height="6" rx="2" fill="#ccc"/>
|
|
17
|
-
<rect x="68" y="152" width="65" height="6" rx="2" fill="#ccc"/>
|
|
18
|
-
<rect x="68" y="164" width="55" height="6" rx="2" fill="#ccc"/>
|
|
19
|
-
<rect x="140" y="85" width="56" height="85" rx="4" fill="#e94560" opacity="0.2"/>
|
|
20
|
-
<text x="168" y="135" font-family="Arial" font-size="32" font-weight="bold" fill="#e94560" text-anchor="middle">S</text>
|
|
21
|
-
</svg>
|