n0one 06e24e35e1
All checks were successful
Build and Push Docker Image / build-and-push (release) Successful in 1m59s
Changed 127.0.0.1 to 0.0.0.0
2025-09-15 14:36:54 +03:00
2025-09-06 01:18:56 +03:00
2025-09-15 14:36:54 +03:00
2025-09-06 01:18:56 +03:00
2025-09-06 01:09:30 +03:00
2025-09-06 01:45:55 +03:00
2025-09-06 01:18:56 +03:00
2025-09-06 03:37:55 +03:00
2025-09-03 20:49:19 +03:00

Habr article API

This is a simple API that can be deployed on your server to access habr.com's articles content, as well as keeping a record of articles and their ratings which you can manage by connecting to corresponding endpoints.

From here on on out we will call a pair "article_url" - "rating" an entry.

API Reference

Ping

  GET /api/ping

A basic ping endpoint.

Response on success

application/json

{
  "message": "pong"
}

See current entries

  GET /api/rates

Returns all entries in the PostreSQL DB.

Response on success

application/json

{
  "article_url_1": rating(0 or 1),
  "article_url_2": rating(0 or 1),
  ...
}

Make a new entry

  POST /api/article/rate

Save a new entry to the DB.

Request body

application/json

{
  "url": {article_url},
  "rating": {integer, 0 or 1}
}

Response on success

application/json

{
  "message": "success",
  "url": "{article_url}",
  "rating": {integer, 0 or 1}
}

Delete an entry

  POST /api/article/remove_rate

Delete an existing entry from the DB.

Request body

application/json

{
  "url": "{article_url}"
}

Response on success

application/json

{
  "message": "success"
}

Get article html

  POST /api/article/api/article/get/html

Get hmtl of a desired habr article body encoded in base64.

Request body

application/json

{
  "url": "{article_url}"
}

Response on success

text/plain

{article_url}

{b64 encoded html}

Get article MD

  POST /api/article/api/article/get/md

Get md of a desired habr article body encoded in base64.

Request body

application/json

{
  "url": "{article_url}"
}

Response on success

text/plain

{article_url}

{b64 encoded md}

Get html of N articles from habr.com/feed

  POST /api/article/api/articles/get/html

Get html bodies of N last articles from habr.com/feed

Request body

application/json

{
  "amount": {articles_amount}
}

Response on success

application/json

{
  "{article_url_1}": "{b64_encoded_html}",
  "{article_url_2}": "{b64_encoded_html}",
  ...
  "{article_url_n}": "{b64_encoded_html}"
}

Get MD of N articles from habr.com/feed

  POST /api/article/api/articles/get/md

Get MD of N last articles from habr.com/feed

Request body

application/json

{
  "amount": {articles_amount}
}

Response on success

application/json

{
  "{article_url_1}": "{b64_encoded_md}",
  "{article_url_2}": "{b64_encoded_md}",
  ...
  "{article_url_n}": "{b64_encoded_md}"
}
Description
No auth fastapi API that scrapes articles from habr.com
Readme 72 KiB
Languages
Python 100%