knadh / tg-archive

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

Failed to load media when post has link #109

Closed sm-g closed 1 year ago

sm-g commented 1 year ago
building site
Traceback (most recent call last):
  File "C:\Users\smg\AppData\Local\Programs\Python\Python311\Scripts\tg-archive-script.py", line 33, in <module>
    sys.exit(load_entry_point('tg-archive==1.1.2', 'console_scripts', 'tg-archive')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\smg\AppData\Local\Programs\Python\Python311\Lib\site-packages\tg_archive-1.1.2-py3.11.egg\tgarchive\__init__.py", line 161, in main
    b.build()
  File "C:\Users\smg\AppData\Local\Programs\Python\Python311\Lib\site-packages\tg_archive-1.1.2-py3.11.egg\tgarchive\build.py", line 100, in build
    self._build_rss(rss_entries, "index.rss", "index.atom")
  File "C:\Users\smg\AppData\Local\Programs\Python\Python311\Lib\site-packages\tg_archive-1.1.2-py3.11.egg\tgarchive\build.py", line 154, in _build_rss
    media_mime = magic.from_file(media_path, mime=True)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\smg\AppData\Local\Programs\Python\Python311\Lib\site-packages\magic\magic.py", line 135, in from_file
    return m.from_file(filename)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\smg\AppData\Local\Programs\Python\Python311\Lib\site-packages\magic\magic.py", line 85, in from_file
    with open(filename):
         ^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument: 'media/https://mastera.academy/old-ad/'

Seems like it caused by https://t.me/mastera_academy/5435 forwarded my private group which I sync, it has link to https://mastera.academy/old-ad and suddenly this used as filename - invalid on my Windows machine. I see only 4 images in media folder after --sync (should be more)

db:

image