All about RSS (Real Simple Syndication)
Tags: webdev, javascript, programming, react
Published: 2023-12-27 21:08:48

In the ever-evolving landscape of the internet, staying updated with the latest information can be overwhelming. Whether you're an avid reader, content creator, or developer, managing a multitude of websites for updates can be time-consuming. This is where Really Simple Syndication (RSS) steps in as a game-changer. In this blog post, we'll dive into the world of RSS, exploring its significance & functionalities.

## How I found RSS?
So from last month I was working on my own website & I was making a section that when you click on every platform the page will update & show all of my blog in DEV, Medium & LinkedIn. 
I talked to my teammate which is a backend developer, & he told me that he can build an API that can get all of the data **BUT** it was illegal!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cb94uhvzj3rgfd1y1jyn.png)

So I went through lots of blogs & YouTube videos till one of the Senior developers told me that I should search for something name **RSS Feed**. I got so excited when I worked with the API's that this platform provided for me to catch the feeds. & now I want to talk about this cool thing that I found! let's go.

## Understanding RSS:
RSS, which stands for "Really Simple Syndication" or "Rich Site Summary," is a web feed that allows users to access updates to online content in a standardized, machine-readable format. The fundamental idea behind RSS is to simplify the process of distributing and consuming information on the internet. Instead of manually visiting multiple websites to check for updates, users can subscribe to RSS feeds and receive consolidated updates in one place.

## How RSS Works:
RSS operates on a publish-subscribe model. Content publishers create an RSS feed containing a summary of their content, and users subscribe to these feeds using RSS readers. When new content is published on a website, the RSS feed is updated automatically. Subscribers receive these updates in their chosen RSS reader, providing a centralized hub for all the latest information.

## Advantages of RSS:

- Time Efficiency:
RSS streamlines the process of content consumption, saving time by presenting updates in a centralized location.

- Customization:
Users have the flexibility to subscribe to specific feeds based on their interests, creating a personalized and tailored content experience.

- Reduced Information Overload:
By aggregating content in one place, RSS helps users avoid information overload and focus on what matters most to them.

- Consistent Format:
RSS feeds follow a standardized format, making it easier for developers to integrate and manipulate the data programmatically.

## Does RSS Feeding have different functionality from Scripting a website?
Yes, RSS feeding is a specific mechanism designed for content distribution and consumption with a focus on updates and subscriptions. Website scraping, on the other hand, is a broader term that encompasses various methods for extracting data from websites, and it's not necessarily focused on real-time updates or a standardized format.

**Main goal of RSS Feeding:**
The primary goal of RSS feeding is to streamline content distribution and consumption, making it easier for users to stay informed without visiting each website individually.

**Main goal of Scraping a website:**
Website scraping is more flexible and can be used for various purposes, such as gathering pricing information, monitoring changes on a website, or extracting data for research and analysis.

## Let's see it in real project
So we work with Medium API for getting feeds that you can access to all their RSS API's from **[this ](https://help.medium.com/hc/en-us/articles/214874118-Using-RSS-feeds-of-profiles-publications-and-topics)** link.
First look at the code below & then I'll explain what is going on.

```
const [feedData, setFeedData] = useState([]);

  useEffect(() => {
    const fetchData = async () => {
      try {
        const response = await axios.get(
          "https://api.rss2json.com/v1/api.json",
          {
            params: {
              rss_url: "https://medium.com/feed/@parsafarahani",
            },
          }
        );

        // Assuming the data structure from the Medium RSS feed is stored in response.data.items
        setFeedData(response.data.items);
      } catch (error) {
        console.error("Error fetching Medium feed:", error);
      }
    };

    fetchData();
  }, []);
```
First of all I made a state here to save & update my data so the site & data will always be update. as you can see I used UseEffect to update the data only one time when the browser loads. in our effect I called the current API that I get using chatGPT by Axios & give the feed API as params to it. then I update my state with the data I want & finally call the function.
now I can all of my data from my Medium profile and use it in my components.

You may ask me what exactly this "https://api.rss2json.com/v1/api.json" API will do?
Well this is an API endpoint provided by rss2json.com, and it converts RSS feeds into JSON format so with that we don't need to convert our data to JSON in our code.

## At the end

In conclusion, RSS helps you to get any data from others or your profile and use it as you want. but keep in mind that that website should support RSS feature so that you can use it.
I hope this blog helped you to make more creative stuff! 

> Any opinion? let me know in the comments🙏.