🍄Etherdump 해보기

Etherdump 소개

깃허브?에도 있는데 이게 맞는지는 불확실.

varia의 etherdump 모음집

varia는 뭐죠?

constantvzw의 etherdump 모음집

constantvzw는 뭐죠?

요렇게 한때, 신나게 사용했던 패드에서 나눈 대화가 더이상 진행하지 않는 상태에 도달한 경우, 아카이브 차원에서, 그리고 패드서버의 부담을 덜기위해서, 그리고 인쇄 및 웹 출판에 유리하기 위해서, PAD->HTML로 변환해주는 도구입니당.

Etherdump를 해봅시다!

이것은 어떤 실행프로그램이기 때문에, 서버에 설치해서 하는 것 같습니당. 어렁 해봅시당

코드: 아까 위에 링크보다 이게 더 좋아보이는 듯

코드 링크는 여기네요..

Etherdump 서버작업 로그

원래 우루루 서버에는 기본 python은 없고, pyenv로 설정해서 쓴다. etherdump 전용의 가상환경 만들어줌.

doohoyi@y:~$ python --version
pyenv: python: command not found

The `python' command exists in these Python versions:
  3.10.4
  3.10.4/envs/matrix-synapse
  3.12.5
  matrix-synapse

Note: See 'pyenv help global' for tips on allowing both
      python2 and python3 to be found.
doohoyi@y:~$ pyenv versions
* system (set by /home/doohoyi/.pyenv/version)
  3.10.4
  3.10.4/envs/matrix-synapse
  3.12.5
  matrix-synapse --> /home/doohoyi/.pyenv/versions/3.10.4/envs/matrix-synapse
doohoyi@y:~$ pyenv virtualenv 3.12.5 etherdump
doohoyi@y:~$ cd etherpad-lite/
doohoyi@y:~/etherpad-lite$ cd ..
doohoyi@y:~$ git clone https://gitlab.com/activearchives/etherdump.git
Cloning into 'etherdump'...
remote: Enumerating objects: 626, done.
remote: Total 626 (delta 0), reused 0 (delta 0), pack-reused 626 (from 1)
Receiving objects: 100% (626/626), 133.86 KiB | 7.87 MiB/s, done.
Resolving deltas: 100% (357/357), done.
doohoyi@y:~$ cd etherdump/
doohoyi@y:~/etherdump$ ls
bin  etherdump  LICENSE.txt  Makefile  padinfo.sample.json  README.md  setup.py
doohoyi@y:~/etherdump$ python --version
pyenv: python: command not found

The `python' command exists in these Python versions:
  3.10.4
  3.10.4/envs/matrix-synapse
  3.12.5
  3.12.5/envs/etherdump
  etherdump
  matrix-synapse

Note: See 'pyenv help global' for tips on allowing both
      python2 and python3 to be found.
doohoyi@y:~/etherdump$ pyenv local etherdump 
(etherdump) doohoyi@y:~/etherdump$ python --version
Python 3.12.5
(etherdump) doohoyi@y:~/etherdump$ pip install python-dateutil jinja2 html5lib
python setup.py install
Collecting python-dateutil
  Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting jinja2
  Downloading jinja2-3.1.6-py3-none-any.whl.metadata (2.9 kB)
Collecting html5lib
  Downloading html5lib-1.1-py2.py3-none-any.whl.metadata (16 kB)
Collecting six>=1.5 (from python-dateutil)
  Downloading six-1.17.0-py2.py3-none-any.whl.metadata (1.7 kB)
Collecting MarkupSafe>=2.0 (from jinja2)
  Downloading MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.0 kB)
Collecting webencodings (from html5lib)
  Downloading webencodings-0.5.1-py2.py3-none-any.whl.metadata (2.1 kB)
Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Downloading jinja2-3.1.6-py3-none-any.whl (134 kB)
Downloading html5lib-1.1-py2.py3-none-any.whl (112 kB)
Downloading MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23 kB)
Downloading six-1.17.0-py2.py3-none-any.whl (11 kB)
Downloading webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Installing collected packages: webencodings, six, MarkupSafe, python-dateutil, jinja2, html5lib
Successfully installed MarkupSafe-3.0.2 html5lib-1.1 jinja2-3.1.6 python-dateutil-2.9.0.post0 six-1.17.0 webencodings-0.5.1

[notice] A new release of pip is available: 24.2 -> 25.1.1
[notice] To update, run: python3.12 -m pip install --upgrade pip
Traceback (most recent call last):
  File "/home/doohoyi/etherdump/setup.py", line 2, in <module>
    import setuptools
ModuleNotFoundError: No module named 'setuptools'
(etherdump) doohoyi@y:~/etherdump$ pip install setuptools
Collecting setuptools
  Downloading setuptools-80.9.0-py3-none-any.whl.metadata (6.6 kB)
Downloading setuptools-80.9.0-py3-none-any.whl (1.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 10.8 MB/s eta 0:00:00
Installing collected packages: setuptools
Successfully installed setuptools-80.9.0

[notice] A new release of pip is available: 24.2 -> 25.1.1
[notice] To update, run: python3.12 -m pip install --upgrade pip
(etherdump) doohoyi@y:~/etherdump$ python setup.py install
running install
/home/doohoyi/.pyenv/versions/etherdump/lib/python3.12/site-packages/setuptools/_distutils/cmd.py:90: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!


...
...
...
        
dead.letter                            go                                     mbox                 synapse
dmesg.log                              grav                                   nano.save            Sync.off
docker-zulip                           grav-admin                             octomode             texlive
docker-zulip_zulip.backup              hugo_extended_0.121.1_linux-amd64.deb  paradezzz            writefreely_0.15.0_linux_amd64.tar.gz
docker-zulip_zulip.copy                hugo_extended_0.139.4_linux-amd64.deb  pdfxup
etherdump                              IMG_3929.MOV                           prosody-filer-1.0.3
doohoyi@y:~$ cd -
/home/doohoyi/etherdump
(etherdump) doohoyi@y:~/etherdump$ ls
bin  build  etherdump  etherdump.egg-info  LICENSE.txt  Makefile  padinfo.sample.json  README.md  setup.py
(etherdump) doohoyi@y:~/etherdump$ mkdir mydump
(etherdump) doohoyi@y:~/etherdump$ cd mydump/
(etherdump) doohoyi@y:~/etherdump/mydump$ etherdump
-bash: etherdump: command not found
(etherdump) doohoyi@y:~/etherdump/mydump$ cd ..
(etherdump) doohoyi@y:~/etherdump$ ls
bin  build  etherdump  etherdump.egg-info  LICENSE.txt  Makefile  mydump  padinfo.sample.json  README.md  setup.py
(etherdump) doohoyi@y:~/etherdump$ cd bin/
(etherdump) doohoyi@y:~/etherdump/bin$ ls
etherdump
(etherdump) doohoyi@y:~/etherdump/bin$ cd ..
(etherdump) doohoyi@y:~/etherdump$ cd mydump/
(etherdump) doohoyi@y:~/etherdump/mydump$ ../bin/etherdump --help
Error performing command 'sync'
(python said: No module named 'etherdump.commands.sync')

Usage:
    etherdump CMD

where CMD could be:
    appendmeta
    creatediffhtml
    deletepad
    dumpcsv
    gethtml
    gettext
    html5tidy
    index
    init
    join
    listauthors
    list
    pull
    pushhtml
    revisionscount
    sethtml
    settext
    showmeta
    status

For more information on each command try:
    etherdump CMD --help


(etherdump) doohoyi@y:~/etherdump/mydump$ ../bin/etherdump init
Please type the URL of the etherpad: https://every.dianaband.info/
The APIKEY is the contents of the file APIKEY.txt in the etherpad folder
Please paste the APIKEY: 
*************************************************
(etherdump) doohoyi@y:~/etherdump/mydump$ ../bin/etherdump --help
Error performing command 'sync'
(python said: No module named 'etherdump.commands.sync')

Usage:
    etherdump CMD

where CMD could be:
    appendmeta
    creatediffhtml
    deletepad
    dumpcsv
    gethtml
    gettext
    html5tidy
    index
    init
    join
    listauthors
    list
    pull
    pushhtml
    revisionscount
    sethtml
    settext
    showmeta
    status

For more information on each command try:
    etherdump CMD --help

요렇게 해서 설치와 작동 확인 OK

Etherdump 사용해보기

(etherdump) doohoyi@y:~/etherdump/mydump$ ../bin/etherdump list
...
...
...

(etherdump) doohoyi@y:~/etherdump/mydump$ ../bin/etherdump gethtml --help
usage: calls the getHTML API function for the given padid [-h] [--padinfo PADINFO] [--showurl] [--format FORMAT] [--rev REV] padid

positional arguments:
  padid              the padid

options:
  -h, --help         show this help message and exit
  --padinfo PADINFO  settings, default: .etherdump/settings.json
  --showurl
  --format FORMAT    output format, can be: text, json; default: text
  --rev REV          revision, default: latest

html 페이지를 한번 뽑아봅니당...

(etherdump) doohoyi@y:~/etherdump/mydump$ ../bin/etherdump gethtml 서비스와_나🧢_day8
<!DOCTYPE HTML><html><body><h4>&#9918;&#65039; &#49436;&#48708;&#49828;&#50752; &#45208;&#129506; - &#9729;&#65039;8&#9729;&#65039; &#9918;&#65039;</h4><br><br><br>&#128681; &#45208;&#47564;&#51032; &#46020;&#47700;&#51064; &#49324;&#50857;&#54616;&#44592; - suhyouri LOG<br><ul class="indent"><li>

...
...
...

&#x2F;var&#x2F;log&#x2F;nginx&#x2F;xu4.ururu.cloud-access.log;<br>&nbsp;&nbsp;&nbsp; error_log &#x2F;var&#x2F;log&#x2F;nginx&#x2F;xu4.ururu.cloud-error.log debug;<br>}<br><br></body></html>
(etherdump) doohoyi@y:~/etherdump/mydump$ 

위에 나온거를 그대로 붙여서 웹서비스 내보내보았습니당.

하지만, 저자색깔 표시가 없어서... 좋으면서도, 좀 실망.

Etherdump 에 creatediffhtml 관련 버그 수정

아래 파일을 조금 고쳐야 했습니당.
etherdump/etherdump/commands/creatediffhtml.py 의 4-5줄을 아래와 같이 바꿔줍니다. (인공지능이 후딱 도와줌)

from urllib.parse import urlencode                                                                                                             
from urllib.request import urlopen                                                                                                             
from urllib.error import HTTPError, URLError                                                                                                   

그리고 나면, 이것을 실행해서 결과를 얻을 수가 있는데...

(etherdump) doohoyi@y:~/etherdump/mydump$ ../bin/etherdump creatediffhtml 서비스와_나🧢_day8
b'<style>\n.authora_xaCrca7E7QgoEIj1 {background-color: #f0f0a8}\n.authora_6GIQU2DDvxooETYw {background-color: #eaaedd}\n.authora_Afy1RwPDMs2nLQXi {background-color: #e5c3ff}\n.authora_d2X78SMdTX0PWsKe {background-color: #cda8f0}\n.authora_4Ux9n18KQzRCooVS {background-color: #e1ffff}\n.authora_X6Vj6DyfcKg5e7Q1 {background-color: #fff6cf}\n.authora_vzHvVxFaxn39epL7 {background-color: #f0e1ff}\n.authora_qXEBoLhWF9uyCz9F {background-color: #fff4b3}\n.authora_FmPplo1DFW9RZ2Fa {background-color: #a3ffff}\n.authora_NUdQOpUOdgnCDb2a {background-color: #faf6ca}\n.authora_2etDOvl68z4v2fO3 {background-color: #ffc7c7}\n.authora_rfMVZu1QN7JLqWCu {background-color: #f2f2a6}\n.removed {text-decoration: line-through; -ms-filter:\'p

...
...
...

br><br><span class="authora_FmPplo1DFW9RZ2Fa">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Note you might want to pass more headers etc too. See above configs.</span><br><span class="authora_FmPplo1DFW9RZ2Fa">&nbsp;&nbsp;&nbsp; }</span><br><br><span class="authora_FmPplo1DFW9RZ2Fa">&nbsp;&nbsp;&nbsp; access_log &#x2F;var&#x2F;log&#x2F;nginx&#x2F;xu4.ururu.cloud-access.log;</span><br><span class="authora_FmPplo1DFW9RZ2Fa">&nbsp;&nbsp;&nbsp; error_log &#x2F;var&#x2F;log&#x2F;nginx&#x2F;xu4.ururu.cloud-error.log debug;</span><br><span class="authora_FmPplo1DFW9RZ2Fa">}</span><br><br>'

html을 준것은 아니고... n을 전부 엔터(줄바꿈)으로 고치고.. 시작하는 b' 와 끝에 있는 ' 을 지워서, 웹에 올리면 원하는 걸 얻을 수가 있음. 아마, 이렇게 수작업으로 하라는게 아니고.. 뭔가 프로그램적으로 html 템플릿에 끼워넣으라는 것 같아욤.

Subhyphae