Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,42 @@
|
|
| 1 |
-
import
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
df = pd.read_parquet(url)
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
|
| 11 |
-
print(df.shape)
|
| 12 |
|
| 13 |
-
|
| 14 |
-
preview = df.head(10).copy()
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
if preview[col].dtype == "object":
|
| 19 |
-
preview[col] = preview[col].apply(
|
| 20 |
-
lambda x: "<BYTES>" if isinstance(x, (bytes, bytearray)) else x
|
| 21 |
-
)
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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", 203)
|
|
|
|
| 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())
|