diff options
author | terminaldweller <thabogre@gmail.com> | 2021-07-30 14:39:08 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2021-07-30 14:39:08 +0000 |
commit | 66456f1680eb08e9da23676a364ad8f84b27f3f8 (patch) | |
tree | 20b2985ce4012ab4b3c5816cf65137c3ca21576b /main.py | |
parent | added config for newspaper. added gitpod configs. (diff) | |
download | devourer-66456f1680eb08e9da23676a364ad8f84b27f3f8.tar.gz devourer-66456f1680eb08e9da23676a364ad8f84b27f3f8.zip |
added gtts and readability
Diffstat (limited to '')
-rwxr-xr-x | main.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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) |