A lightweight Go API that fetches and parses Medium RSS feeds, providing clean JSON responses for easy consumption.
- 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
-
Clone and navigate to the project:
git clone https://github.com/orhantugrul/medium-rsjs.git cd medium-rsjs -
Install dependencies:
go mod download
-
Run the server:
go run src/main.go
-
Test the API:
curl http://localhost:8080/api/health curl http://localhost:8080/api/feed/@username
-
Build the image:
docker build -t medium-rsjs . -
Run the container:
docker run -p 8080:8080 medium-rsjs
-
Test the API:
curl http://localhost:8080/api/health
GET /api/feed/{username}
Example:
curl http://localhost:8080/api/feed/@usernameResponse:
{
"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"]
}
]
}PORT- Server port (default: 8080)GIN_MODE- Set to "release" for productionTRUSTED_PROXIES- Comma-separated list of trusted proxy IPs