README.md (view raw)
1# tg2md
2
3This script parses output from Telegram channel and converts each post to
4jekyll-applicable post in markdown.
5
6Telegram Desktop creates JSON file, as well as different directories containing
7multimedia, photos, etc. This script creates new directory and populates it with
8formatted posts ready to publish.
9
10## basic usage
11
12Firstly you need to export your channel history from Telegram Desktop app.
13This could be done from three dots menu. Then popup menu appears, where
14you can choose what data you want to export. The script currently supports
15only photos, voice messages and audio files.
16
17
18
19In format menu you should specify 'Machine-readable JSON' file and then
20locate to directory of your desire.
21
22To convert your posts to markdown files you need to copy `parse.py` file into
23your export folder and run it there.
24
25```console
26$ cp parse.py /path/to/export/dir
27$ cd /path/to/export/dir
28$ python parse.py
29```
30
31Currently there's no way to change name of ouput folder other than directly
32editing the script. By default it's creating directory `formatted_posts` with
33markdown files in there.
34
35Also if your jekyll directory storing media files in folders other than `photos`
36and `files`, you should change `photo_dir` and `media_dir` variables.
37
38## todo's
39
40- use argparse module instead of crap
41- replies
42- single/muliple tags
43- forwarded posts
44- custom post header