knadh / tg-archive

A tool for exporting Telegram group chats into static websites like mailing list archives.
MIT License
829 stars 121 forks source link

error and question #119

Open vinniec opened 10 months ago

vinniec commented 10 months ago

Ok I had opened this issue to ask a question but now that I tried to do the --build I experienced an error.

tg-archive --build
2023-11-06 00:33:39,305: building site
Traceback (most recent call last):
  File "G:\fla\thonny\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "G:\fla\thonny\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "G:\fla\thonny\Scripts\tg-archive.exe\__main__.py", line 7, in <module>
  File "G:\fla\thonny\lib\site-packages\tgarchive\__init__.py", line 161, in main
    b.build()
  File "G:\fla\thonny\lib\site-packages\tgarchive\build.py", line 87, in build
    self._render_page(messages, month, dayline,
  File "G:\fla\thonny\lib\site-packages\tgarchive\build.py", line 116, in _render_page
    html = self.template.render(config=self.config,
  File "G:\fla\thonny\lib\site-packages\jinja2\environment.py", line 1301, in render
    self.environment.handle_exception()
  File "G:\fla\thonny\lib\site-packages\jinja2\environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 90, in top-level template code
  File "G:\fla\thonny\lib\site-packages\jinja2\environment.py", line 485, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'collections.OrderedDict object' has no attribute '2022-09-21'

Obviously I have no clue what is missing, I must say that I had to restart the --sync a couple of times due to connection problems, however it got to the end without any problems and now when I restart it it finishes quickly without any errors:

tg-archive --sync
2023-11-06 00:44:06,135: Failed to load SSL library: <class 'OSError'> (no library called "ssl" found)
2023-11-06 00:44:06,145: cryptg detected, it will be used for encryption
2023-11-06 00:44:06,944: starting Telegram sync (batch_size=2000, limit=0, wait=5, mode=standard)
2023-11-06 00:44:07,015: Connecting to 149.154.175.55:443/TcpFull...
2023-11-06 00:44:07,181: Connection to 149.154.175.55:443/TcpFull complete!
2023-11-06 00:44:08,205: fetching from last message id=6123 (2023-11-05 00:00:00)
2023-11-06 00:44:12,303: finished. fetched 0 messages. last message = 2023-11-05 00:00:00

is there any way to do a check of the whole database?, if everything has been downloaded correctly?, I would like to avoid having to re-download the media because it is so many things.

this was the content of the previous issues: I'm saving the content of a group with your program, in truth I'm not done yet, however the goal afterward is to catalog part of the messages to filter them.

Now it's not like I have much idea how to do it, looking at the code of tg-archive I understand that maybe the way would be to add a table to the db with tags and populate it (however I don't know yet what would be a practical way) and modify the template so that there are sections where there are only tagged messages.

It's not like I know much about it, would you have any advice? Thanks!

vinniec commented 10 months ago

ok i found this issue https://github.com/knadh/tg-archive/issues/99 , is there any way to avoid re-downloading the media while changing the date to utc?

vinniec commented 10 months ago

I tried again by disabling the media to quickly download the messages and try to do build (I noticed that there is no external reference to the media in the database, I hope I won't have to re-download it again) but it gives again another error:

tg-archive --build
2023-11-06 01:38:58,294: building site
Traceback (most recent call last):
  File "G:\fla\thonny\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "G:\fla\thonny\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "G:\fla\thonny\Scripts\tg-archive.exe\__main__.py", line 7, in <module>
  File "G:\fla\thonny\lib\site-packages\tgarchive\__init__.py", line 161, in main
    b.build()
  File "G:\fla\thonny\lib\site-packages\tgarchive\build.py", line 100, in build
    self._build_rss(rss_entries, "index.rss", "index.atom")
  File "G:\fla\thonny\lib\site-packages\tgarchive\build.py", line 154, in _build_rss
    media_mime = magic.from_file(media_path, mime=True)
  File "G:\fla\thonny\lib\site-packages\magic\magic.py", line 135, in from_file
    return m.from_file(filename)
  File "G:\fla\thonny\lib\site-packages\magic\magic.py", line 85, in from_file
    with open(filename):
OSError: [Errno 22] Invalid argument: 'media/https://www.youtube.com/watch?v=Eb2m5ATyGEs'