Spaces:
Runtime error
Runtime error
File size: 1,195 Bytes
78b07ad |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
import uuid
import requests
from .utility import TGraph
def post_to_telegraph(
title: str,
content: str,
author: str = "[ π§πΎπ
π
π‘ππ ]",
url: str = "https://t.me/Its_HellBot",
) -> str:
content = content.replace("\n", "<br>")
try:
response = TGraph.telegraph.create_page(
title=title,
html_content=content,
author_name=author,
author_url=url,
)
except Exception:
rnd_key = uuid.uuid4().hex[:8]
title = f"{title}_{rnd_key}"
response = TGraph.telegraph.create_page(
title=title,
html_content=content,
author_name=author,
author_url=url,
)
return f"https://te.legra.ph/{response['path']}"
def spaceBin(data: str, extension: str = "none") -> str:
data = {
"content": data,
"extension": extension,
}
resp = requests.post("https://spaceb.in/api/v1/documents/", data)
try:
result = resp.json()
url = f"https://spaceb.in/{result['payload']['id']}"
except Exception:
url = ""
return url
|