Giter Site home page Giter Site logo

telegramfuse's Introduction

Keep In Mind

Though Telegram allows file uploads, it is not intended to be used as cloud storage. Your files could be lost at any time. Don't rely on this project (or any similar ones) for storing important files on Telegram. Storing large amounts of files on this could result in Telegram deleting your files or banning you, proceed at your own risk.

TelegramFS

A FUSE program that stores files on Telegram.

Though I demonstrated Discord in the video too, I haven't included the code here. While I believe that storing your OWN files on Discord does NOT violate TOS, I think that spreading the code to do so might. Idk I'm trying to not actually get banned :)

Usage and How to Run

Requirements

  • Linux. Sorry Windows gamers, probably WSL would work
  • Python - I used 3.10.12
  • libfuse3
  • A non-negligible amount of memory, if you plan to upload large files. I ran this on a system with 16GB RAM and that was usually enough, but I had occasional crashes uploading lots of large files in a row.

To Run

Before running this, I recommend creating a virtual environment in Python.

  • (optional) Create a venv with python -m venv <your-env-name>
  • Rename .env.sample to .env and fill in the variables with appropriate values. Here's a description of these values and where you can get them from:
    • APP_ID and APP_HASH: You can get these from https://my.telegram.org/myapp. AGAIN, storing large amounts of files could get you banned. So be careful and take precautions if you care about losing your account.
    • CHANNEL_LINK: the link to your Telegram channel.
    • SESSION_NAME: this can be whatever you want, just the name that will be used for the file storing details of your Telegram session.
  • Run pip install -r requirements.txt.
    • This might fail to get pyfuse3. If it does, you may be missing some requirements. On my system (Ubuntu 20.04), running this command to install some exta packages worked for me: sudo apt install meson cmake fuse3 libfuse3-dev libglib2.0-dev pkg-config. You can also install from these directions: http://www.rath.org/pyfuse3-docs/install.html
  • Enable the user_allow_other option in /etc/fuse.conf.
  • Run python main.py <path/to/your/mount> for instance, python3 main.py ./telegramfs will mount at the directory `telegramfs`` in the current working dir. The directory you are mounting must exist.

Known Issues

Uploading large files to Telegram (more than ~3GB) may result in degraded performance or the system killing the process for using too much memory. This is probably my fault. I found the behavior of memory management in Python is a bit strange, even calling gc.collect() after clearing the buffer doesn't always seem to work. It could also be an issue with the LRU cache I implemented... I don't have the patience to wait 20 minutes for it to crash and then debug, especially because the vast majority of my files are pretty small.

Error handling is somewhat lacking. If Telegram uploads fail, you'll probably see message in console, but it won't retry. Worst case, you can delete whatever file you were trying to upload and try again.

TO UNMOUNT, IF SOMETHING BREAKS

fusermount -u <path/of/your/mount>

telegramfuse's People

Contributors

devdetour avatar oliomin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

telegramfuse's Issues

How to properly link the telegram channel

Traceback (most recent call last):
File "/home/george/installs/TelegramFUSE/fuse/../Telegram/main.py", line 18, in
init()
File "/home/george/installs/TelegramFUSE/fuse/../Telegram/main.py", line 14, in init
client = TelegramFileClient(session_name, api_id, api_hash, channel_link)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/george/installs/TelegramFUSE/Telegram/TelegramFUSE.py", line 34, in init
self.channel_entity = self.client.get_entity(channel_link)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/george/.local/lib/python3.11/site-packages/telethon/sync.py", line 39, in syncified
return loop.run_until_complete(coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/george/.local/lib/python3.11/site-packages/telethon/client/users.py", line 337, in get_entity
result.append(await self._get_entity_from_string(x))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/george/.local/lib/python3.11/site-packages/telethon/client/users.py", line 576, in _get_entity_from_string
raise ValueError(
ValueError: Cannot find any entity corresponding to "https://web.telegram.org/k/#-2030084758"

Mount empty

Hi,

first of all thank you. I am currently trying to get it up but I am stuck and need some help to debug it further.

OS: Ubuntu 22.04
Python: Python3.10
Fuse: libfuse3-3

.env is proparly set with my App details. Telegram Channel link is for example https://t.me/cKure

~/TelegramFUSE/Telegram$ python3 main.py mount/
USING ENCRYPTION:  False

That's all I see after running it.

tail -f example.log 
DEBUG:telethon.extensions.messagepacker:Assigned msg_id = 7333236048030067348 to ResolveUsernameRequest (7f5b2699c6a0)
DEBUG:telethon.network.mtprotosender:Encrypting 1 message(s) in 32 bytes for sending
DEBUG:telethon.network.mtprotosender:Encrypted messages put in a queue to be sent
DEBUG:telethon.network.mtprotosender:Waiting for messages to send...
DEBUG:telethon.extensions.messagepacker:Assigned msg_id = 7333236048031886956 to MsgsAck (7f5b2694fee0)
DEBUG:telethon.network.mtprotosender:Encrypting 1 message(s) in 36 bytes for sending
DEBUG:telethon.network.mtprotosender:Encrypted messages put in a queue to be sent
DEBUG:telethon.network.mtprotosender:Waiting for messages to send...
DEBUG:telethon.network.mtprotosender:Handling RPC result for message 7333236048030067348
DEBUG:telethon.network.mtprotosender:Receiving items from the network...

That's all, any idea?

Thanks in advanced.

Why use libfuse when you can use a normal folder?

I saw the video about this project and it seems like libfuse is making it confusing to develop and only works on linux, i dont mind i use linux you should use linux, come to thr linux side of life its better more freedom morr flexibility.

Anyyyway just use a normal folder instad of libfuse, thats what syncthing dose, you give it a folder to keep synced with your computers and it just works. No fake drive mount needed. It just looks a the folder to see if it changed, dosnt need librefuse nice and simpile.

really needs more detailed guide

This guide doesn't tell how to git clone, doesn't have .env samples (because it might be hard for people to understand the format) , it may be hard for people to determine where bot ID and token is in the message from the bot father and etc. Please make your guide more understandable and detailed, because, for example, I couldn't understand every aspect and got an error. I appreciate your efforts to release your project and made even this guide, but, please, understand more detailed the guide will be, more people will be able to implement the project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.