Giter Site home page Giter Site logo

html-telegraph-poster's People

Contributors

mercuree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

html-telegraph-poster's Issues

How to edit a previously created page?

I have a page that I created earlier. How can I change it? Something like code:
link_page = 'https://telegra.ph/mypagetoedit'
t.edit(link_page, text=link_page.text + 'my new text')

Cannot get token

Cannot get token, see the error
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='api.telegra.ph', port=443): Max retries exceeded with url: /createAccount?short_name=Elon+Musk&author_name=Elon&author_url=https%3A%2F%2Fwww.spacex.com%2F (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000002D970B8F4C0>, 'Connection to api.telegra.ph timed out. (connect timeout=None)'))

Article updated instead of posted

I always use post method to post new articles. but very often my old post (previous one) is updated, instead of being posted as a new article with new link.

Proxy.

Hello.
Could you add the ability to work through a proxy?
Best regards.

JSONDecodeError, Seems like Telegraph isn't returning a json response

I am a regular user and use this great module in my project, still a sudden error occurred

  File "/app/.heroku/python/lib/python3.9/site-packages/telegram/ext/utils/promise.py", line 96, in run
    self._result = self.pooled_function(*self.args, **self.kwargs)
  File "/app/Sagiri/__main__.py", line 211, in doujin
    post = nyah.post(title = f"{hen.title()}", author = "DontKnow", text = tx)
  File "/app/.heroku/python/lib/python3.9/site-packages/html_telegraph_poster/html_to_telegraph.py", line 147, in post
    result = self.edit()
  File "/app/.heroku/python/lib/python3.9/site-packages/html_telegraph_poster/html_to_telegraph.py", line 164, in edit
    result = _upload_via_api(access_token=self.access_token, path=path or self.path, **params)
  File "/app/.heroku/python/lib/python3.9/site-packages/html_telegraph_poster/html_to_telegraph.py", line 85, in _upload_via_api
    resp = requests.post(api_url + method, params, headers={'User-Agent': user_agent}).json()
  File "/app/.heroku/python/lib/python3.9/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/app/.heroku/python/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/app/.heroku/python/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/app/.heroku/python/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

It looks like telegram isnt giving json responses, i still dont know though what is wrong, because it was working for two months as a telegram bot deployed on heroku, so it is a Telegraph server error i guess, but i when i tried it in my terminal it worked perfectly! What could be the problem i am facing, is Telegraph blocking my ip or something? . Please Help if you can Thanks!

Exception: Error while uploading the image

Recently, I have been experiencing an issue when trying to upload an image file using the command html_telegraph_poster.upload_images("file_path.jpg"). This issue has become more frequent, to the point where I am no longer able to upload images.

Doing some testsing I was able to discover that the result of the request for the upload was <Response [500]>.
I also tried to upload the image by myself imitating the method used here (changing some parameters) but without any success.

But I've found this website, which could upload the same images without anz problem.
Does anzone have anz solution for this?

Html code doesn't work in author fields

Hi! This is best poster for telegraph but I have seen that if I use author It give me html code in my post and not url to website.

url = 'http://.... '
writer = 'john johnson'
t = TelegraphPoster()
result = t.post(title=titolo, author=writer, text=testo)
Am I wrong doing something wrong?

P.S. In text field hypertext url works fine.

Option to auto upload images

Is it a good idea to add a parameter option auto_upload_images:
When this parameter is used, the images in the <img> tag will be automatically uploaded and the URLs will be replaced.

Consider switching from lxml's clean_html for enhanced security (and possibly performance)

I'd like to bring to your attention that we are discussing the possibility of removing lxml's clean_html functionality from lxml library. Over the past years, there have been several concerning security vulnerabilities discovered within the lxml library's clean_html functionality โ€“ CVE-2021-43818, CVE-2021-28957, CVE-2020-27783, CVE-2018-19787 and CVE-2014-3146.

The main problem is in the design. Because the lxml's clean_html functionality is based on a blocklist, it's hard to keep it up to date with all new possibilities in HTML and JS.

Two viable alternatives worth considering are bleach and nh3. Here's why:

bleach:

  • Bleach is a widely adopted Python library specifically designed for sanitizing and cleaning HTML input.
  • It has a strong track record in terms of security โ€“ it's allowed-list-based.
  • It was deprecated in January but it will still receive security updates, support for new Pythons and bugfixes, see upstream issue.

nh3:

  • nh3 is Python binding for the ammonia library. Ammonia is written in Rust and it's also allowed-list-based.
  • Thanks to the Rust backend, nh3 is also significantly faster than bleach.
  • Rust backend is nothing to be afraid of. nh3 uses the latest PyO3 compatible with Python 3.12 and provides wheels built on top of compatible ABI for different architectures and platforms.

We'll probably move the cleaning part of the lxml to a distinct project first so it will still be possible to use it but better is to find a suitable alternative sooner rather than later.

Let me know if we can help you with this transition anyhow and have a nice day.

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.