aedocw / epub2tts

Turn an epub or text file into an audiobook
Apache License 2.0
496 stars 45 forks source link

Add ability to read copy from a URL #35

Closed aedocw closed 1 year ago

aedocw commented 1 year ago

Adding something like this would be nice, treat it as text, just from a URL rather than local file:

(add newspaper3k to requirements.txt)

import requests
from bs4 import BeautifulSoup
from newspaper import Article

def get_main_body(url):
    article = Article(url)
    article.download()
    article.parse()
    return article.text

url = "https://<url>"
text = get_main_body(url)