n8n-guide
n8n-guide
N8n community
Chat room
Sign In

(Use Case) Daily Cartoon Delivery (⭐)

Tags
Empty
Date of creation
Nov 20, 2024 12:17 PM
Name
(Use Case) Daily Cartoon Delivery (⭐)
Category
Empty
Author
  • data_popcorn

Download Workflow

Prerequisite

•
OpenAI API

Scenario

💡
One line summary
•
An automated workflow that fetches Calvin and Hobbes comics every morning, translates them, and shares them on Discord.

Step 1

•
Trigger: Schedule Trigger
◦
How to set up :
1.
Add a "Schedule Trigger" node.
2.
Set the trigger to run every morning at 9:00.
•
Select Time Interval in Rule and set Hour to 9 .
◦
Role : Automatically runs the workflow once a day.

Step 2

•
Set: Parameters
◦
How to set up :
1.
Add a "Set" node.
2.
Define the following three variables:
•
Year : ={{ $now.format('yyyy') }} (Current Year)
•
Month : ={{ $now.format('MM') }} (Current Month)
•
Day : ={{ $now.format('dd') }} (Current Date)
◦
Role : Stores Year , Month , and Day as variables based on the current date .

Step 3

•
HTTP Request: Get Cartoon Image
◦
How to set up :
1.
Add an "HTTP Request" node.
2.
Set the URL as follows:
=https://www.gocomics.com/calvinandhobbes/{{ $json.year }}/{{ $json.month }}/{{ $json.day }}
1.
Set the Method to GET .
◦
Role : Gets the HTML page of the Calvin and Hobbes comic.

Step 4

•
Information Extractor: Extract Image URL
◦
How to set up :
1.
Add an "Information Extractor" node.
2.
Set the following text: (Change Fixed → Expression)
아래 HTML에서 <img class="img-fluid lazyloaded"> 태그 안에 있는 src값만 추출해줘. 값 외에는 다른 요소는 필요 없어.


e.g.)
EXAMPLE INPUT)
<img class="img-fluid lazyloaded" srcset="https://assets.amuniversal.com/5ed526b06e94013bda88005056a9545d 900w" data-srcset="https://assets.amuniversal.com/5ed526b06e94013bda88005056a9545d 900w" sizes="
                       (min-width: 992px) 900px,
                       (min-width: 768px) 600px,
                       (min-width: 576px) 300px,
                       900px" width="100%" alt="Calvin and Hobbes Comic Strip for March 03, 2023 " src="https://assets.amuniversal.com/5ed526b06e94013bda88005056a9545d">


EXAMPLE OUTPUT)
https://assets.amuniversal.com/5ed526b06e94013bda88005056a9545d

--
(INPUT)
{{ $json.data }} 
3.
Use the output of "HTTP Request" as input data.
a.
Schema Type: From Attribute Descriptions
•
Attributes
◦
Name : cartoon_image
◦
Type:String
◦
Value: EXAMPLE OUTPUT) https://assets.amuniversal.com/***
◦
Role : Extract comic image URLs from fetched HTML.

Step 5

•
OpenAI: Translate Cartoon Text
◦
How to set up :
1.
Add an "OpenAI" node.
2.
Select the model gpt-4o-mini .
3.
Set the text as:
실제 대화하듯이 그리고 원문과 한글로 번역해서 병기로 표기해줘.

EXAMPLE)
Calvin: "YOU'VE NEVER HAD AN OBLIGATION, AN ASSIGNMENT, OR A DEADLINE IN ALL YOUR LIFE! YOU HAVE NO RESPONSIBILITIES AT ALL! IT MUST BE NICE!" (너는 평생 한 번도 의무, 과제, 혹은 마감일 없었잖아! 전혀 책임이 없다니! 정말 좋겠다!)
Hobbes: "WIPE THAT INSOLENT SMIRK OFF YOUR FACE!" (그 뻔뻔한 미소를 그만 지어!)
4.
Use image URLs extracted from "Information Extractor" as input data.
◦
Role : Analyze text contained in cartoon images and translate it into Korean.

Step 6

•
Discord: Send Cartoon
◦
How to set up :
1.
Add a "Discord" node.
2.
Set the Webhook URL (requires Discord Webhook URL).
3.
Write your message like this:
Daily Cartoon ({{ $('param').item.json.year }}/{{ $('param').item.json.month }}/{{ $('param').item.json.day }})
{{ $('Information Extractor').item.json.output.cartoon_image }}

{{ $json.content }}
◦
Role : Post analyzed comic images to the Discord channel.

Final connection structure

1.
Schedule Trigger → Set (Parameters)
2.
Set (Parameters) → HTTP Request
3.
HTTP Request → Information Extractor
4.
Information Extractor → OpenAI
5.
OpenAI → Discord
By following this guide, you can automatically fetch and translate your Calvin and Hobbes comics every morning, and share the results on Discord. 🚀
Made with Slashpage