-
Notifications
You must be signed in to change notification settings - Fork 4
/
telegraph_post.py
29 lines (25 loc) · 1.04 KB
/
telegraph_post.py
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
import argparse
from telegram import telegram
from telegraph import Telegraph
__author__ = 'Kanishk Singh (Arion Miles)'
__license__ = "MIT"
PARSER = argparse.ArgumentParser(description="Telegra.ph submitter")
PARSER.add_argument('-title', '-t', type=str, help="Post title", required=False)
PARSER.add_argument('-content', '-c', type=str, nargs='*', help="Post content", required=False)
ARGS = PARSER.parse_args()
def telegraph_submit(message_title, message_content):
title = message_title
content = message_content
telegraph = Telegraph()
telegraph.create_account(short_name='FileBot')
response = telegraph.create_page(title, html_content=content)
posted = 'http://telegra.ph/{}'.format(response['path'])
telegram(title, posted)
if __name__ == '__main__':
title = ARGS.title
content = ARGS.content
telegraph = Telegraph()
telegraph.create_account(short_name='FileBot')
response = telegraph.create_page(title, html_content=content)
posted = 'http://telegra.ph/{}'.format(response['path'])
print posted