Open Cristinutaa opened 4 years ago
If you want to parse text from a html file on your system I suggest you do:
with open('path/to/yourfile', 'r') as f:
html = f.read()
article = Article(url='yoururl')
article.download(input_html=html)
article.parse()
print(article.text)
>> your article text
File uris as input are not (yet?) supported.
If you're scarping from Web and you get the same error, check the link prefix. Does it start with http/s? www?
I'm trying to test the following function:
For this, I have a local index.html file When passing the url = "file://path/to/html/index.html" to my functions, I get
newspaper.article.ArticleException: Article
download()failed with No connection adapters were found for 'file://path/to/html/index.html' on URL file://path/to/html/index.html
I've read that requests only support http and https, but you are using local files in the test repository of the newspaper library. What happens?