如何以编程方式获取etherpad的实时明文内容?

时间:2010-10-28 02:51:26

标签: etherpad

这个问题出现在etherpad-open-source-discuss的邮件列表中,我认为在这里提供它会很有用。

5 个答案:

答案 0 :(得分:3)

只需构建一个这样的URL并获取它:

http://dtherpad.com/ep/pad/export/foo/latest?format=txt

这将获得http://dtherpad.com/foo

的实时纯文本内容

例如,在PHP中,您可以使用

获取它

的file_get_contents( “http://dtherpad.com/ep/pad/export/foo/latest?format=txt”)

请注意,这只是每个打击垫的“导入/导出”菜单中提供的“导出到纯文本”链接。

答案 1 :(得分:3)

其他一些可能性:

答案 2 :(得分:2)

似乎Ari在他的回复中提到的javascript函数不再出现在当前版本的Etherpad中,如http://etherpad.mozilla.org

等网站上所实现的那样

但是你现在可以在eherpad的javascript中使用以下javascript函数来获取最新版本的文本

padeditor.ace.exportText()

答案 3 :(得分:2)

您可以使用jQuery获取以太网的纯文本内容:

jQuery(document).ready(function(){
    jQuery('#export').click(function(){
        var padId = 'examplePadIntense';//Id of the div in which etherpad lite is integrated
        var epframeId = 'epframe'+ padId;
        var frameUrl = $('#'+ epframeId).attr('src').split('?')[0];
        var contentsUrl = frameUrl + "/export/txt";
        jQuery.get(contentsUrl, function(data) {
            var textContent = data;
        });
    });
});

答案 4 :(得分:0)

您还可以使用IFS="=" while read -r port value do echo "Content of $port is $value" done <$host HTTP api检索便笺簿的内容。

有关更多详细信息,请参见我的other answer

相关问题