sondakika 1.0.4 → 1.0.6
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/AGENTS.md +31 -5
- package/README.md +2 -0
- package/index.js +70 -5
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -7,7 +7,7 @@ This is a simple Node.js CLI application that fetches and displays news from RSS
|
|
|
7
7
|
## Project Structure
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
|
|
10
|
+
sondakika/
|
|
11
11
|
├── index.js # Main CLI entry point
|
|
12
12
|
├── package.json # Project dependencies and scripts
|
|
13
13
|
└── AGENTS.md # This file - guidelines for AI agents
|
|
@@ -23,10 +23,11 @@ node index.js # Direct execution
|
|
|
23
23
|
# With arguments
|
|
24
24
|
node index.js ntv # Show NTV news (default 10 items)
|
|
25
25
|
node index.js ntv 15 # Show 15 NTV news items
|
|
26
|
+
node index.js haberturk 5 # Show Habertürk 5 news
|
|
26
27
|
|
|
27
|
-
# Global installation (for '
|
|
28
|
+
# Global installation (for 'sondakika' command)
|
|
28
29
|
npm link
|
|
29
|
-
|
|
30
|
+
sondakika ntv 15 # Run as global command
|
|
30
31
|
```
|
|
31
32
|
|
|
32
33
|
## Adding New RSS Sources
|
|
@@ -36,8 +37,12 @@ To add a new news source, edit `index.js` and add to the `sources` object:
|
|
|
36
37
|
```javascript
|
|
37
38
|
const sources = {
|
|
38
39
|
ntv: 'https://www.ntv.com.tr/son-dakika.rss',
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
// ...
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const sourceInfo = {
|
|
44
|
+
ntv: { name: 'NTV', isSondakika: true }, // isSondakika: true for breaking news
|
|
45
|
+
// ...
|
|
41
46
|
};
|
|
42
47
|
```
|
|
43
48
|
|
|
@@ -46,6 +51,27 @@ Then run with:
|
|
|
46
51
|
node index.js bbc
|
|
47
52
|
```
|
|
48
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
|
+
|
|
49
75
|
## No Test/Lint Commands
|
|
50
76
|
|
|
51
77
|
This project does not currently have:
|
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,28 @@ const sources = {
|
|
|
6
6
|
ntv: 'https://www.ntv.com.tr/son-dakika.rss',
|
|
7
7
|
cumhuriyet: 'http://www.cumhuriyet.com.tr/rss/son_dakika.xml',
|
|
8
8
|
trt: 'https://www.trthaber.com/sondakika.rss',
|
|
9
|
-
mynet: 'https://www.mynet.com/haber/rss/sondakika'
|
|
9
|
+
mynet: 'https://www.mynet.com/haber/rss/sondakika',
|
|
10
|
+
sabah: 'https://www.sabah.com.tr/rss/anasayfa.xml',
|
|
11
|
+
star: 'https://www.star.com.tr/rss/rss.asp?cid=124',
|
|
12
|
+
vatan: 'https://www.gazetevatan.com/rss/gundem.xml',
|
|
13
|
+
haberturk: 'https://www.haberturk.com/rss',
|
|
14
|
+
cnnturk: 'https://cnnturk.com/feed/rss/turkiye',
|
|
15
|
+
yenisafak: 'https://www.yenisafak.com/rss',
|
|
16
|
+
aa: 'https://www.aa.com.tr/en/rss'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const sourceInfo = {
|
|
20
|
+
ntv: { name: 'NTV', isSondakika: true },
|
|
21
|
+
cumhuriyet: { name: 'Cumhuriyet', isSondakika: true },
|
|
22
|
+
trt: { name: 'TRT Haber', isSondakika: true },
|
|
23
|
+
mynet: { name: 'Mynet', isSondakika: true },
|
|
24
|
+
sabah: { name: 'Sabah', isSondakika: false },
|
|
25
|
+
star: { name: 'Star', isSondakika: false },
|
|
26
|
+
vatan: { name: 'Gazete Vatan', isSondakika: false },
|
|
27
|
+
haberturk: { name: 'Habertürk', isSondakika: false },
|
|
28
|
+
cnnturk: { name: 'CNN Türk', isSondakika: false },
|
|
29
|
+
yenisafak: { name: 'Yeni Şafak', isSondakika: false },
|
|
30
|
+
aa: { name: 'Anadolu Ajansı', isSondakika: false }
|
|
10
31
|
};
|
|
11
32
|
|
|
12
33
|
const parser = new Parser();
|
|
@@ -42,21 +63,49 @@ async function fetchNews(source, count) {
|
|
|
42
63
|
const feed = await parser.parseURL(url);
|
|
43
64
|
const items = feed.items.slice(0, count);
|
|
44
65
|
|
|
66
|
+
const firstItem = feed.items[0];
|
|
67
|
+
let latestUpdate = '';
|
|
68
|
+
if (firstItem && (firstItem.pubDate || firstItem.isodate)) {
|
|
69
|
+
const date = new Date(firstItem.pubDate || firstItem.isodate);
|
|
70
|
+
if (!isNaN(date.getTime())) {
|
|
71
|
+
const options = { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit' };
|
|
72
|
+
latestUpdate = date.toLocaleDateString('tr-TR', options);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const sourceKey = source.toLowerCase();
|
|
77
|
+
const info = sourceInfo[sourceKey] || { name: source.toUpperCase(), isSondakika: false };
|
|
78
|
+
const sourceName = info.isSondakika ? `${info.name} (Son Dakika)` : info.name;
|
|
79
|
+
|
|
45
80
|
console.log('\n📰 ' + '═'.repeat(50));
|
|
46
|
-
console.log(` Latest ${items.length} News from ${
|
|
81
|
+
console.log(` Latest ${items.length} News from ${sourceName}`);
|
|
82
|
+
if (latestUpdate) {
|
|
83
|
+
console.log(` Son guncelleme: ${latestUpdate}`);
|
|
84
|
+
}
|
|
47
85
|
console.log(' ' + '═'.repeat(50) + '\n');
|
|
48
86
|
|
|
49
87
|
items.forEach((item, index) => {
|
|
50
88
|
const title = item.title;
|
|
51
89
|
const summary = item.summary || item.contentSnippet || '';
|
|
52
90
|
const link = item.link;
|
|
91
|
+
const pubDate = item.pubDate || item.isodate;
|
|
92
|
+
|
|
93
|
+
let dateStr = '';
|
|
94
|
+
if (pubDate) {
|
|
95
|
+
const date = new Date(pubDate);
|
|
96
|
+
if (!isNaN(date.getTime())) {
|
|
97
|
+
const options = { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit' };
|
|
98
|
+
dateStr = date.toLocaleDateString('tr-TR', options);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
53
101
|
|
|
54
|
-
const titleLines = wrapText(title,
|
|
55
|
-
const summaryLines = wrapText(summary,
|
|
102
|
+
const titleLines = wrapText(title, 60);
|
|
103
|
+
const summaryLines = wrapText(summary, 60);
|
|
56
104
|
|
|
57
105
|
const maxWidth = Math.max(
|
|
58
106
|
...titleLines.map(l => l.length),
|
|
59
107
|
...summaryLines.map(l => l.length),
|
|
108
|
+
dateStr.length,
|
|
60
109
|
3
|
|
61
110
|
);
|
|
62
111
|
|
|
@@ -69,6 +118,11 @@ async function fetchNews(source, count) {
|
|
|
69
118
|
});
|
|
70
119
|
console.log(` │`);
|
|
71
120
|
|
|
121
|
+
if (dateStr) {
|
|
122
|
+
console.log(` │ 📅 ${dateStr}`);
|
|
123
|
+
console.log(` │`);
|
|
124
|
+
}
|
|
125
|
+
|
|
72
126
|
summaryLines.forEach(line => {
|
|
73
127
|
console.log(` │ ${line}`);
|
|
74
128
|
});
|
|
@@ -96,17 +150,28 @@ if (args.length === 0 || args[0] === '--help') {
|
|
|
96
150
|
Usage:
|
|
97
151
|
sondakika <source> [count]
|
|
98
152
|
|
|
99
|
-
Sources:
|
|
153
|
+
Sources (Son Dakika):
|
|
100
154
|
ntv NTV Son Dakika
|
|
101
155
|
cumhuriyet Cumhuriyet
|
|
102
156
|
trt TRT Haber
|
|
103
157
|
mynet Mynet
|
|
104
158
|
|
|
159
|
+
Sources (Haberler):
|
|
160
|
+
sabah Sabah
|
|
161
|
+
star Star
|
|
162
|
+
vatan Gazete Vatan
|
|
163
|
+
haberturk Habertürk
|
|
164
|
+
cnnturk CNN Türk
|
|
165
|
+
yenisafak Yeni Şafak
|
|
166
|
+
aa Anadolu Ajansı
|
|
167
|
+
|
|
105
168
|
Examples:
|
|
106
169
|
sondakika ntv # NTV haberleri (varsayilan 10 adet)
|
|
107
170
|
sondakika ntv 15 # NTV 15 haber
|
|
108
171
|
sondakika trt # TRT Haber
|
|
109
172
|
sondakika mynet 5 # Mynet 5 haber
|
|
173
|
+
sondakika sabah # Sabah haberleri
|
|
174
|
+
sondakika haberturk 5 # Habertürk 5 haber
|
|
110
175
|
`);
|
|
111
176
|
process.exit(0);
|
|
112
177
|
}
|