From 66456f1680eb08e9da23676a364ad8f84b27f3f8 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Fri, 30 Jul 2021 19:09:08 +0430 Subject: added gtts and readability --- main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index e5794e1..c72b674 100755 --- a/main.py +++ b/main.py @@ -9,6 +9,9 @@ from contextlib import closing from requests import get from requests.exceptions import RequestException from re import findall +from readability import Document +from gtts import gTTS +from datetime import datetime as time class Argparser(object): @@ -85,8 +88,11 @@ def main(): try: a.download() a.parse() - # print(a.html) - print(a.text) + doc = Document(a.html) + print(doc.summary()) + if a.text != '': + tts = gTTS(a.text) + tts.save(time.today().strftime("%b-%d-%Y-%M-%S-%f")+".mp3") except Exception as e: logging.exception(e) -- cgit v1.2.3