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 run `tg2md.py` program
23which takes path to your `result.json` file as first argument.
24
25```console
26$ python tg2md.py path/to/result.json
27```
28
29By default it will create `formatted_posts` directory in your current directory
30and populate it with markdown files. If you want to specify other location,
31use `--out-dir` flag
32
33```console
34$ python tg2md.py result.json --out-dir path/to/post/output
35```
36
37Also if your jekyll directory storing media files in folders other than `photos`
38and `files`, you should specify their location with `--photo-dir` and
39`--media-dir` flags respectively. Note that they only change links in the
40markdown files.
41
42## todo's
43
44- replies
45- single/muliple tags
46- forwarded posts
47- custom post header