Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Check for updates to pages using API endpoint #29

Open
Frewacom opened this issue Feb 18, 2021 · 0 comments
Open

Check for updates to pages using API endpoint #29

Frewacom opened this issue Feb 18, 2021 · 0 comments
Labels
api Implementation of the API parser Implementation of the API response parser

Comments

@Frewacom
Copy link
Collaborator

texttv.nu has an API-endpoint that checks for updates of pages based on the date_updated_unix field. This should be implemented and used to determine whether or not a cached page should be re-fetched or not.

API endpoint:

https://texttv.nu/api/updated/<page(s)>/<unix date for cached page>?app=<id>

Responses

The following responses are for a single page (100), but it is possible to fetch for multiple pages at once by separating them with comma. The res array will then contain the updated pages of those specified in the URL. This allows us to batch cached pages together if needed.

No update available:

{
  "is_ok": true,
  "update_available": false,
  "res": [] 
}

Update available:

{
  "is_ok": true,
  "update_available": true,
  "res": [
    {
      "id": "29548492",
      "page_num": "100",
      "date_updated": "2021-02-18 07:58:43",
      "title": "Flera på FHM hotas - får nu polisskydd | Ökning av unga som sökte skuldsanering | Inrikes",
      "date_added": "2021-02-18 07:58:43"
    }
  ]
}

This would also be useful for creating notifications (#25), since we can store the previous unix date for certain pages, e.g. page 101-102 and check for updates without parsing the page.

@Frewacom Frewacom added this to To do in TTT - Terminal Text Tv via automation Feb 18, 2021
@Frewacom Frewacom added api Implementation of the API parser Implementation of the API response parser labels Feb 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api Implementation of the API parser Implementation of the API response parser
Projects
Development

No branches or pull requests

1 participant