GithubHelp home page GithubHelp logo

bdim404 / hackernews-summarize-telegram-bot Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 77 KB

This is a bot used with this [Hacker News Feed Telegram chnnel](https://t.me/hacker_news_feed), forword the message to the bot and return the summarize to you.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
hackernews openai openai-api summarizer telegram telegram-bot

hackernews-summarize-telegram-bot's Issues

Add requirements.

It will be helpful to add requirement file when the first time user deploy this bot.

Add MAX_CHAR_LENGTH.

Sometimes retweeted articles and comments will exceed the tokens limit, plus a maximum character limit, if this limit is exceeded then the last content of the article will be deleted from the comments until the maximum character limit is met.

There are some problems in some site.

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/telegram/ext/_application.py", line 1195, in process_update
    await coroutine
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/telegram/ext/_basehandler.py", line 153, in handle_update
    return await self.callback(update, context)
  File "/Volumes/bdim'stonge/work_and_learn/python learning/hackernewSummarizeBot.py", line 102, in handle_message
    content = h2t.handle(html)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/html2text/__init__.py", line 142, in handle
    self.feed(data)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/html2text/__init__.py", line 139, in feed
    super().feed(data)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/html/parser.py", line 110, in feed
    self.goahead(0)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/html/parser.py", line 170, in goahead
    k = self.parse_starttag(i)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/html/parser.py", line 344, in parse_starttag
    self.handle_starttag(tag, attrs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/html2text/__init__.py", line 191, in handle_starttag
    self.handle_tag(tag, dict(attrs), start=True)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/html2text/__init__.py", line 327, in handle_tag
    tag_style = element_style(attrs, self.style_def, parent_style)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/html2text/utils.py", line 72, in element_style
    assert attrs["class"] is not None
AssertionError

Something upgrade

I'm going to revamp the following two points:

On the one hand is to take only the first 10 comments in the comment section, if the token is too long it will return an error to the bot.

On the other hand add authentication, still using .env.

add stream

add "stream" when openai return the message.

Authentication support.

As above, summarize bot now can be accessed by everyone, need to add authentication feature, may related to #1.

Add env and coding to the head.

Something like:

# !/usr/bin/env python
# -*- coding: utf-8 -*

I think it is always the best practice to write this statement :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.