1. Opening Problem Statement
Meet Alice, a tech enthusiast and startup founder who loves staying updated with the latest trends and discussions on Hacker News. Every morning, she spends at least 30 minutes manually browsing through the Hacker News homepage, copying top headlines, and saving URLs in her notes before emailing herself reminders to revisit important stories later. This process is tedious, repetitive, and prone to errors like missing a key news link or copying outdated information. Over a month, Alice wastes approximately 15 hours maintaining this manual routine, time that could have been better invested in growing her business.
Does Alice’s struggle sound familiar? If you rely on Hacker News for critical updates, manually collecting news can quickly become inefficient and overwhelming. The problem intensifies when you must share these updates with a team or keep a well-organized, date-stamped archive for reference.
2. What This Automation Does
This n8n workflow solves Alice’s problem by fully automating the extraction, organization, and delivery of top Hacker News articles. Here’s what happens when you run the workflow or trigger it manually:
- Fetch Latest Hacker News: The workflow retrieves the main Hacker News page using an HTTP Request node.
- Extract Titles and URLs: It scrapes all news headlines and their direct links using the HTML Extract node specifically targeting the “storylink” CSS class.
- Create Organized Lists: It separates the extracted titles and URLs into two distinct item lists, preparing them for merging.
- Merge Titles and URLs by Index: The Merge node pairs each title with its corresponding URL based on their position in the lists, ensuring accurate data alignment.
- Export to Timestamped Spreadsheet: The combined data is saved into a spreadsheet file named with the current date, making historical tracking easy.
- Email the Spreadsheet: Finally, the workflow sends the spreadsheet as an attachment via email, with a customizable subject and message body.
By automating these steps, Alice saves over 15 hours a month, eliminates manual errors, and maintains a clear archive of daily news while delivering it directly to her inbox.
3. Prerequisites ⚙️
- 🔌 n8n Account: A working n8n instance (cloud or self-hosted).
- 🌐 Internet Access: To fetch the Hacker News URL.
- 📧 SMTP Email Credentials: To configure the Send Email node for sending the news.
Optional: For those preferring full control, self-hosting n8n is an option to avoid cloud limits.
4. Step-by-Step Guide to Set Up This Automation
Step 1: Start with Manual Trigger
Open n8n and create a new workflow. Click Nodes → Manual Trigger. This node allows you to kick off the workflow on demand. You should see a simple box with an “Execute” button once configured. This is your starting point for testing.
Step 2: Configure HTTP Request to Fetch Hacker News
Add an HTTP Request node and connect it to the Manual Trigger. Set the URL to https://news.ycombinator.com/. Under Options, enable Full Response and set Allow Unauthorized Certs to true in case of certificate issues. Leave headers and query parameters empty. This node downloads the entire Hacker News homepage HTML as a binary file input for the next step.
Step 3: Extract News Titles and URLs
Drag the HTML Extract node next. Connect it to the HTTP Request node. In its settings, select Source Data as Binary. Add two extraction values:
news_titlewith CSS selector.storylinkto get text content as an array.news_urlwith CSS selector.storylinkbut return thehrefattribute as an array.
This extracts all the top story titles and their URLs separately.
Step 4: Convert Extracted Arrays into Lists
Add two Item Lists nodes: one for news_title and one for news_url. Connect these nodes to the HTML Extract node. Configure each to split out its respective field into individual items, preparing them for merging.
Step 5: Merge Titles and URLs
Drag in a Merge node and connect your two Item Lists nodes to it—titles as the first input, URLs as the second. Set mode to Merge By Index. This ensures the right title matches the right URL based on their order in the scraped arrays.
Step 6: Export to Spreadsheet File
Add a Spreadsheet File node connected to the Merge node. Set its operation to “toFile”. For file name, use:
Ycombinator_news_{{new Date().toISOString().split('T', 1)[0]}}.xlsxThis generates a date-stamped filename automatically. Name the sheet “Latest news”. The node converts the merged data into an Excel file ready for emailing.
Step 7: Configure Email Notification to Send File
Connect a Email Send node next. Set your SMTP credentials and configure the email:
- To Email: Your recipient address
- From Email: Sender address configured in SMTP
- Subject: “Ycombinator news”
- Text: “Here are the latest news attached!”
- Attachments: Use the spreadsheet file output from the Spreadsheet node
Save and test the entire workflow by clicking Execute. You should receive an email with the daily Hacker News attached as an Excel spreadsheet.
5. Customizations ✏️
Customize Email Content
In the Send Email node, modify the Subject or Text fields to personalize the message your recipients get. This helps tailor communication for your team or clients.
Change News Source URL
Update the HTTP Request node’s URL if you want to scrape news from a different website using similar CSS selectors. Ensure the HTML Extract node selectors are adjusted accordingly for accurate scraping.
Alter Spreadsheet Format
The Spreadsheet File node supports multiple formats (e.g., xlsx, csv). Change the file extension in the filename parameter (e.g., .csv) to produce a CSV instead of Excel.
Schedule Automatic Runs
Add a Cron node (not in current workflow) before the HTTP Request node to run this workflow automatically every day at a chosen time.
6. Troubleshooting 🔧
Problem: “No news items extracted from HTML Extract node.”
Cause: Hacker News changed their website’s CSS class names or structure.
Solution: Inspect the new website elements (right-click and inspect element), update the CSS selectors in the HTML Extract node accordingly.
Problem: “SMTP email failed to send.”
Cause: Incorrect SMTP credentials or firewall blocking outgoing emails.
Solution: Double-check your SMTP login, port, and encryption settings in the Email Send node credentials. Test with a different email account if possible.
7. Pre-Production Checklist ✅
- Verify the HTTP Request node successfully fetches a response from Hacker News (status 200).
- Confirm HTML Extract returns non-empty arrays for titles and URLs.
- Test the merged output data preview to ensure titles correctly match URLs.
- Ensure the spreadsheet node creates a file with correct data format and timestamp.
- Send a test email to yourself to verify SMTP settings and file attachment.
8. Deployment Guide
Once tested, activate the workflow. If you want automatic daily emails, add a Cron node to trigger this workflow on schedule. Always monitor the workflow execution logs in n8n for errors or broken links.
9. FAQs
Q: Can I use Gmail SMTP instead of other email providers?
A: Yes, configure Gmail SMTP credentials in the Email Send node for secure email delivery.
Q: Will this workflow consume API credits?
A: No, it scrapes public Hacker News HTML and uses SMTP for emails, so no paid API calls are involved.
Q: Is my data secure?
A: Your emails and scraped data remain within your n8n environment. Always secure your SMTP credentials and use encrypted connections.
10. Conclusion
By setting up this n8n automation, you’ve transformed a tedious daily news scraping task into a seamless, error-free process. You now have an automated way to receive top Hacker News stories via email, saving significant time and keeping your information organized with date-stamped spreadsheets.
Next steps? You might automate other favorite news sources, add sentiment analysis to headlines, or integrate Slack notifications in addition to emails. Keep refining your workflow to suit your evolving needs—automation is your ally!
Enjoy your newfound productivity and stay informed effortlessly!