是否可以直接从电报聊天发布到telegra.ph?

时间:2017-08-30 10:32:27

标签: telegram

除了拥有云信使平台外,Telegram还有一个名为telegra.ph的博客网站。它在功能上与Medium或WordPress相当,并使用Telegram帐户作为发布帐户。可以通过与机器人帐户@telegraph聊天来登录此帐户,但据我所知,实际创建和编辑帖子只能在网络浏览器中完成。

是否可以直接从聊天界面发布到telegra.ph?我找不到怎么做,但也许我看起来不太好。

谢谢!

2 个答案:

答案 0 :(得分:0)

您可以使用API​​执行您提出的问题http://telegra.ph/api

答案 1 :(得分:0)

可以使用api.telegra.ph或tgraph.io/api将聊天直接发送到telegra.ph或tgraph.io/api。 如果需要,我将为您提供我创建的API,以使您更轻松地使用python编程语言来进行此操作。

import json
MAIN_URL = 'https://api.telegra.ph/'

class apiuz():
    def __init__(self):
        self.http = requests.Session()

    def callMethod(self, n_method=None, a_method=None):
        xitoy2= MAIN_URL + n_method.__name__+'?'
        for x,y in a_method:
            if x!='self' and y!=None: xitoy2+=x+'='+str(y)+'&'
        response = self.http.get(xitoy2[:-1])
        xitoy2 = eval(response.text.replace('\/','/').replace('true','True').replace('false','False'))
        return xitoy2 

        #Methods created by @apiuz
    def createAccount(self, short_name=None, author_name=None, author_url=None):
        return self.callMethod(n_method=self.createAccount, a_method=locals().items())

    def editAccountInfo(self, access_token=None, short_name=None, author_name=None, author_url=None):
        return self.callMethod(n_method=self.editAccountInfo, a_method=locals().items())

    def getAccountInfo(self, access_token=None, field=None):
        return self.callMethod(n_method=self.getAccountInfo, a_method=locals().items())

    def revokeAccessToken(self, access_token=None):
        return self.callMethod(n_method=self.revokeAccessToken, a_method=locals().items())

    def createPage(self, access_token=None, title=None, author_name=None, author_url=None,
        content=None):
        return self.callMethod(n_method=self.createPage, a_method=locals().items())

    def editPage(self, access_token=None, path=None, title=None, content=None,
        author_name=None, author_url=None):
        return self.callMethod(n_method=self.editPage, a_method=locals().items())

    def getPage(self, path=None):
        return self.callMethod(n_method=self.getPage, a_method=locals().items())

    def getPageList(self, access_token=None, offset=0, limit=50):
        return self.callMethod(n_method=self.getPageList, a_method=locals().items())

    def getViews(self, path=None, year=None, month=None, day=None, hour=None):
        return self.callMethod(n_method=self.getPageList, a_method=locals().items())