Neon-tech commited on
Commit
7100ded
·
verified ·
1 Parent(s): 2dd3ae4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -42
app.py CHANGED
@@ -1,42 +1,10 @@
1
- import asyncio
2
- import os
3
- import zipfile
4
- from pyrogram import Client
5
-
6
- session_string = os.environ.get("session_string")
7
-
8
-
9
- async def main():
10
- app = Client(
11
- name="x",
12
- session_string=session_string
13
- )
14
-
15
- await app.start()
16
-
17
- msg = await app.get_messages("nt123456nt", 28)
18
-
19
- file_path = await msg.download()
20
- print("Downloaded:", file_path)
21
-
22
- with zipfile.ZipFile(file_path, "r") as z:
23
- z.extractall("out")
24
-
25
- print("Extracted to: out")
26
-
27
- for root, _, files in os.walk("out"):
28
- for f in files:
29
- path = os.path.join(root, f)
30
-
31
- print("\n---", f, "---")
32
-
33
- try:
34
- with open(path, "r") as file:
35
- print(file.read())
36
- except:
37
- print("binary/unreadable")
38
-
39
- await app.stop()
40
-
41
-
42
- asyncio.run(main())
 
1
+ import shutil, json
2
+ from pathlib import Path
3
+
4
+ for item in ["/data/image-shards", "/data/images_state.json"]:
5
+ p = Path(item)
6
+ if p.exists():
7
+ shutil.rmtree(p) if p.is_dir() else p.unlink()
8
+ print(f"✓ Deleted {item}")
9
+ else:
10
+ print(f" Skipped {item} — not found")