CHU0397 | National Taiwan Normal University
Step 1
Being aware of the steps you are going through if you had to manually copy and paste the data you want into an Excel file, and document each step with as many details as possible.
Step 2
Understanding the structure of a website, how to access the structure of the website, and where the information you want are.
Step 3
Finally, mapping the R functions to the information you want.
Taiwanese newspaper called “ETtoday” (https://www.ettoday.net/).
We will be working with the following link:

🌐 Step 1: Browse
Go to the ETtoday website and navigate to find a single article of interest.
🤖 Step 2: Code-like precision
Describe every single action as if you were explaining it to a robot. Leave zero ambiguity!
Click on the link.
Select the date of the news you are interested in.
Select the type of news (politics, society, etc.).
Click on one of the titles below the search bar.
Browse and observe
What is the web address when you select a particular date, let’s say October 28th, 2024?
And when you select a particular type of article, “politics” for example?
And finally, when you choose an individual article?
Answer
First step: https://www.ettoday.net/news/news-list.htm
Second step (filtered articles): https://www.ettoday.net/news/news-list-2024-10-28-1.htm
Third step (individual article): https://www.ettoday.net/news/20241028/2843953.htm
Think about it
So this means that you can filter the list of articles as you wish just by changing the web address!
No need to despair!
The fact that this article is found in the list means that the web address of the individual article must be somewhere on the website… but where?
This is the moment when it is important to understand the structure of the website.
https://www.ettoday.net/news/news-list-2024-10-28-1.htm.
Look for a blank space, right-click, and you select “View Page Source”.
Then, it will open a new page which can be very scary… but this is actually the same, just the structure of the previous page!
Browse and observe - Part 1
Browse and observe - Part 2
This version of the website is really where you can find all the information that you need. For example, please have a look at lines 514 to 541 (see the image below).
This must be more familiar to you: these are the web addresses that you obtain when you filter different types of articles!
Now, please have a look at line 549… you will see that you have the web addresses of each individual article listed on the webpage!
How did I know what lines to search for?
There’s nothing magical, and I am surely not a psychic who can guess the line numbers. So how to find them? I just use the “search” function (for Windows: “ctrl + f”, for Mac: “command + f”). And then I look for some keywords, such as the names of the types of articles, or the web address of the individual articles.
Let’s call these lines the “structural lines”. These are just lines of code used to create the webpage. There are different programming languages, but for our purpose, we will only need to look at the lines written in html language.
Let’s just have a look at line 549 and decompose it.
<div class="part_list_2">
<h3>
<span class="date">2024/10/28 20:45</span>
<em class="tag c_news">政治</em>
<a target="_blank" href="[https://www.ettoday.net/news/20241028/2843953.htm](https://www.ettoday.net/news/20241028/2843953.htm)">陳吉仲列超思案被告!黃國昌「哇一聲」:北檢終於醒來啦</a>
</h3>
</div>This line corresponds to this part of the website:
Now we can decompose it:
The part with “<div></div>” means that there is a block on the webpage. This block corresponds to the one where all the individual articles are listed. There are many blocks on a webpage, so we can give them different names to avoid confusing them. Here, the block is called “part_list_2”.
The part with “<h3></h3>” corresponds to one line in the block. What is between “<h3>” and “</h3>” is everything we want to put in that line. Here there are three elements:
The first element is a “<span></span>” element, and its name is “date”. What is between “<span>” and “</span>” is the text to display, here: “2024/10/28 20:45”.
The second element is an “<em></em>” element (why “em” and not “span”? “em” stands for “emphasis”, so they look different on the website). Its name is “tag c_news”.
The third element is an “<a></a>” element. This is used to write a text with a link, and the link is specified with “href”. The term target="_blank" means that it opens in a new page when you click on it.
🌐 Step 1: Browse
Look for the dates of the article, the content, the name of the author, the category, etc.
🤖 Step 2: Code-like precision
Describe where it is found using elements like “<div></div>” or “<h3></h3>”, etc.
Important
This seems to be a lot and quite complicated.
So just remember this:
There are big blocks with different names (div, h3, span, etc.). Let’s call them nodes.
Inside nodes, you can specify the parameters and names specific to the nodes.
That’s all!