purplesyringa's blog

By purplesyringa, history, 3 years ago, In English

Hi, Codeforces!

I've just made a script that publishes all new posts (and their updates) on Codeforces to a Telegram channel, with formatting and stuff.

The notifications should are quite fast, they should propagate in less than 5 minutes.

Enjoy!

  • Vote: I like it
  • +63
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it +13 Vote: I do not like it

Did you literally made it in 5 minutes?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +23 Vote: I do not like it

    Well, I started it one-two hours ago. I was making a blog and pushing the final version just when I saw that post. Hence I replied so fast.

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

How does it work? Can you share the code? As codeforces doesn't have rss/atom feed, it is a really good initiative. Thanks.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It parses 'Recent actions' in the sidebar and parses these posts. Then it checks if these posts are new and posts them to Telegram if so. There are some hacks to make Codeforces formatting look better, the rest is rather simple. I'm not sure if I want to share the code because if many people used it, it would increase load on Codeforces servers. You can DM me if you need it.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +11 Vote: I do not like it

      You could've used more reliable API for recent actions (see https://codeforces.com/apiHelp/methods#recentActions) instead of parsing HTML which can change at any moment.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I know about the API and I don't like it. First, it has too low limits to be any useful. Second, the API doesn't return blog content so I'd still have to resort to manual parsing.

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
          Rev. 2   Vote: I like it +5 Vote: I do not like it

          Codeforces API allows 5 requests per second — should be more than enough to load data once and send to all users.

          The API also does return blog content, you have to:
          1. Request recentActions
          2. Request full versions of BlogEntries by IDs from RecentActions using blogEntry.view

          This is fully up to you, of course, it's your bot :)

          • »
            »
            »
            »
            »
            »
            3 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            There are limits other than per second limits. In my experience, even rate limiting API like that doesn't help, you still get 'forbidden' or whatever the error was--I don't remember--if you make many requests per hour.

            Also, I'm not just talking about RPS metric. Some APIs that return lists/arrays don't return more than a few hundreds of records.

          • »
            »
            »
            »
            »
            »
            3 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it
            1. Request full versions of BlogEntries by IDs from RecentActions using blogEntry.view

            That API doesn't return post content.

»
3 years ago, # |
  Vote: I like it +11 Vote: I do not like it

Hi purplesyringa I have a version of the new cf logo in a slightly higher resolution for the profile picture of the channel: link