B
B
brar2020-10-03 13:01:51
linux
brar, 2020-10-03 13:01:51

How to parse the site for new posts?

There is a site with regularly filled articles. There is a poor api. You can get posts by request like:

https://site_site_site.ru/api/posts/?sorting=date_created

Response in json (which, for example, contains the date of each post in epoch format, if it is targeted as a unique or threshold value during parsing).
The idea is that by cron, for example, once a minute, handle this request and, if there is a new post, pull out its link and send it through your simplest telegram bot to the group using php.
As for the cart, I'll deal with it myself. But I don’t know how to implement this simplest parsing.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2020-10-03
@brar

  1. Pulling the API
  2. You collect posts and remember the date of the last one (you can save it to a file)
  3. Pulling the API
  4. If there are posts later than the saved date, you also collect them in a cart. If not, disable the script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question