-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Expand file tree
/
Copy pathHacker News Throwback Machine - See What Was Hot on This Day, Every Year!.json
More file actions
404 lines (404 loc) · 8.18 KB
/
Copy pathHacker News Throwback Machine - See What Was Hot on This Day, Every Year!.json
File metadata and controls
404 lines (404 loc) · 8.18 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
{
"nodes": [
{
"id": "6ea4e702-1af8-407b-b653-964a519db1c2",
"name": "Basic LLM Chain",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
1560,
-360
],
"parameters": {
"text": "=You are a highly skilled news categorizer, specializing in indentifying interesting stuff from Hacker News front-page headlines.\n\nYou are provided with JSON data containing a list of dates and their corresponding top headlines from the Hacker News front page. Each headline will also include a URL linking to the original article or discussion. Importantly, the dates provided will be the SAME DAY across MULTIPLE YEARS (e.g., January 1st, 2023, January 1st, 2022, January 1st, 2021, etc.). You need to indentify key headlines and also analyze how the tech landscape has evolved over the years, as reflected in the headlines for this specific day.\n\nYour task is to indentify top 10-15 headlines from across the years from the given json data and return in Markdown formatted bullet points categorizing into themes and adding markdown hyperlinks to the source URL with Prefixing Year before the headline. Follow the Output Foramt Mentioned.\n\n**Input Format:**\n\n```json\n[\n {\n \"headlines\": [\n \"Headline 1 Title [URL1]\",\n \"Headline 2 Title [URL2]\",\n \"Headline 3 Title [URL3]\",\n ...\n ]\n \"date\": \"YYYY-MM-DD\",\n },\n {\n \"headlines\": [\n \"Headline 1 Title [URL1]\",\n \"Headline 2 Title [URL2]\",\n ...\n ]\n \"date\": \"YYYY-MM-DD\",\n },\n ...\n]\n```\n\n**Output Format In Markdown**\n\n```\n# HN Lookback <FullMonthName-DD> | <start YYYY> to <end YYYY> \n\n## [Theme 1]\n- YYYY [Headline 1](URL1)\n- YYYY [Headline 2](URL2)\n...\n\n## [Theme 2]\n- YYYY [Headline 1](URL1)\n- YYYY [Headline 2](URL2)\n...\n\n... \n\n## <this is optional>\n<if any interesing ternds emerge mention them in oneline>\n```\n\n**Here is the Json data for Hackernews Headlines across the years**\n\n```\n{{ JSON.stringify($json.data) }}\n```",
"promptType": "define"
},
"typeVersion": 1.5
},
{
"id": "b5a97c2a-0c3b-4ebe-aec5-7bca6b55ad4c",
"name": "Google Gemini Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
1740,
-200
],
"parameters": {
"options": {},
"modelName": "models/gemini-1.5-pro"
},
"credentials": {
"googlePalmApi": {
"id": "Hx1fn2jrUvojSKye",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "18cba750-aef5-451d-880f-2c12d8540d78",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-380,
-360
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 21
}
]
}
},
"typeVersion": 1.2
},
{
"id": "341da616-8670-4cd9-b47a-ee25e2ae9862",
"name": "CreateYearsList",
"type": "n8n-nodes-base.code",
"position": [
-200,
-360
],
"parameters": {
"jsCode": "for (const item of $input.all()) {\n const currentDateStr = item.json.timestamp.split('T')[0];\n const currentDate = new Date(currentDateStr);\n const currentYear = currentDate.getFullYear();\n const currentMonth = currentDate.getMonth(); // 0 for January, 1 for February, etc.\n const currentDay = currentDate.getDate();\n\n const datesToFetch = [];\n for (let year = currentYear; year >= 2007; year--) {\n let targetDate;\n if (year === 2007) {\n // Special handling for 2007 to start from Feb 19\n if (currentMonth > 1 || (currentMonth === 1 && currentDay >= 19))\n {\n targetDate = new Date(2007, 1, 19); // Feb 19, 2007\n } else {\n continue; // Skip 2007 if currentDate is before Feb 19\n }\n } else {\n targetDate = new Date(year, currentMonth, currentDay);\n }\n \n // Format the date as YYYY-MM-DD\n const formattedDate = targetDate.toISOString().split('T')[0];\n datesToFetch.push(formattedDate);\n }\n item.json.datesToFetch = datesToFetch;\n}\n\nreturn $input.all();"
},
"typeVersion": 2
},
{
"id": "42e24547-be24-4f29-8ce8-c0df7d47a6ff",
"name": "CleanUpYearList",
"type": "n8n-nodes-base.set",
"position": [
0,
-360
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b269dc0d-21e1-4124-8f3a-2c7bfa4add5c",
"name": "datesToFetch",
"type": "array",
"value": "={{ $json.datesToFetch }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "6e51ad05-0f3d-4bfb-8c8d-5b71e7355344",
"name": "SplitOutYearList",
"type": "n8n-nodes-base.splitOut",
"position": [
200,
-360
],
"parameters": {
"options": {},
"fieldToSplitOut": "datesToFetch"
},
"typeVersion": 1
},
{
"id": "6f827071-718f-4e27-9f7a-cc50296f7bc4",
"name": "GetFrontPage",
"type": "n8n-nodes-base.httpRequest",
"position": [
420,
-360
],
"parameters": {
"url": "=https://news.ycombinator.com/front",
"options": {
"batching": {
"batch": {
"batchSize": 1,
"batchInterval": 3000
}
}
},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "day",
"value": "={{ $json.datesToFetch }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "7287e6b1-337f-4634-ac23-5ceaa87b0db3",
"name": "ExtractDetails",
"type": "n8n-nodes-base.html",
"position": [
640,
-360
],
"parameters": {
"options": {},
"operation": "extractHtmlContent",
"extractionValues": {
"values": [
{
"key": "=headlines",
"cssSelector": ".titleline",
"returnArray": true,
"skipSelectors": "span"
},
{
"key": "date",
"cssSelector": ".pagetop > font"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "fceff31e-4dcd-4199-89c5-8eb75cd479bf",
"name": "GetHeadlines",
"type": "n8n-nodes-base.set",
"position": [
920,
-460
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "e1ce33e9-e4f8-4215-bbdb-156a955a0a97",
"name": "headlines",
"type": "array",
"value": "={{ $json.headlines }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "f7683614-7225-4f05-ba12-86b326fdb4a1",
"name": "GetDate",
"type": "n8n-nodes-base.set",
"position": [
920,
-280
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "fc1d15f6-a999-4d6b-a7bc-3ffa9427679e",
"name": "date",
"type": "string",
"value": "={{ $json.date }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7e09ce85-ece1-46a0-aa59-8e3da66413b2",
"name": "MergeHeadlinesDate",
"type": "n8n-nodes-base.merge",
"position": [
1180,
-360
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3
},
{
"id": "db3bf408-8179-4ca4-a5b4-8a390b68f994",
"name": "SingleJson",
"type": "n8n-nodes-base.aggregate",
"position": [
1380,
-360
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "2abbc0e9-ed1e-4ba0-9d2f-7c3cd314a0fe",
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
2020,
-360
],
"parameters": {
"text": "={{ $json.text }}",
"chatId": "@OnThisDayHN",
"additionalFields": {
"parse_mode": "Markdown",
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "6nIwfhIWcwJFTPTg",
"name": "OnThisDayHNBot"
}
},
"typeVersion": 1.2
}
],
"pinData": {},
"connections": {
"GetDate": {
"main": [
[
{
"node": "MergeHeadlinesDate",
"type": "main",
"index": 1
}
]
]
},
"SingleJson": {
"main": [
[
{
"node": "Basic LLM Chain",
"type": "main",
"index": 0
}
]
]
},
"GetFrontPage": {
"main": [
[
{
"node": "ExtractDetails",
"type": "main",
"index": 0
}
]
]
},
"GetHeadlines": {
"main": [
[
{
"node": "MergeHeadlinesDate",
"type": "main",
"index": 0
}
]
]
},
"ExtractDetails": {
"main": [
[
{
"node": "GetHeadlines",
"type": "main",
"index": 0
},
{
"node": "GetDate",
"type": "main",
"index": 0
}
]
]
},
"Basic LLM Chain": {
"main": [
[
{
"node": "Telegram",
"type": "main",
"index": 0
}
]
]
},
"CleanUpYearList": {
"main": [
[
{
"node": "SplitOutYearList",
"type": "main",
"index": 0
}
]
]
},
"CreateYearsList": {
"main": [
[
{
"node": "CleanUpYearList",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "CreateYearsList",
"type": "main",
"index": 0
}
]
]
},
"SplitOutYearList": {
"main": [
[
{
"node": "GetFrontPage",
"type": "main",
"index": 0
}
]
]
},
"MergeHeadlinesDate": {
"main": [
[
{
"node": "SingleJson",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Basic LLM Chain",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}