Skip to content

Repository files navigation

medium-rsjs

🚀 Publish to ghcr.io

A lightweight Go API that fetches and parses Medium RSS feeds, providing clean JSON responses for easy consumption.

What it does

  • Fetches Medium RSS feeds by username
  • Parses and cleans XML content (removes CDATA, fixes encoding issues)
  • Returns structured JSON with normalized data
  • Handles multiple date formats and normalizes to RFC3339

Quick Start

Local Development

  1. Clone and navigate to the project:

    git clone https://github.com/orhantugrul/medium-rsjs.git
    cd medium-rsjs
  2. Install dependencies:

    go mod download
  3. Run the server:

    go run src/main.go
  4. Test the API:

    curl http://localhost:8080/api/health
    curl http://localhost:8080/api/feed/@username

Docker

  1. Build the image:

    docker build -t medium-rsjs .
  2. Run the container:

    docker run -p 8080:8080 medium-rsjs
  3. Test the API:

    curl http://localhost:8080/api/health

API Endpoints

Get Medium Feed

GET /api/feed/{username}

Example:

curl http://localhost:8080/api/feed/@username

Response:

{
  "title": "User's Medium Feed",
  "description": "Stories by User on Medium",
  "link": "https://medium.com/@username",
  "posts": [
    {
      "title": "Article Title",
      "link": "https://medium.com/@username/article-slug",
      "author": "Author Name",
      "published": "2024-01-01T12:00:00Z",
      "content": [
        {
          "tag": "h4",
          "children": [
            {
              "value": "Article Section"
            }
          ]
        },
        {
          "tag": "p",
          "children": [
            {
              "value": "Article content with structured HTML elements..."
            }
          ]
        },
        {
          "tag": "ul",
          "children": [
            {
              "tag": "li",
              "children": [
                {
                  "tag": "strong",
                  "children": [
                    {
                      "value": "Bold text"
                    }
                  ]
                },
                {
                  "value": " and regular text"
                }
              ]
            },
            {
              "tag": "li",
              "children": [
                {
                  "value": "Another list item"
                }
              ]
            }
          ]
        },
        {
          "tag": "figure",
          "children": [
            {
              "tag": "img",
              "attributes": [
                {
                  "name": "src",
                  "value": "https://example.com/image.jpg"
                },
                {
                  "name": "alt",
                  "value": "Example image"
                }
              ]
            },
            {
              "tag": "figcaption",
              "children": [
                {
                  "value": "Image caption"
                }
              ]
            }
          ]
        }
      ],
      "categories": ["tech", "programming"]
    }
  ]
}

Environment Variables

  • PORT - Server port (default: 8080)
  • GIN_MODE - Set to "release" for production
  • TRUSTED_PROXIES - Comma-separated list of trusted proxy IPs

About

⚡️ Turn Medium's messy RSS feeds into beautiful JSON APIs

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages