pip install newspaper3k python from newspaper import Article article = Article(url) article.download() article.parse() title = article.title author = article.authors publish_date = article.publish_date python from newspaper import Article def is_junk_news(url): article = Article(url) article.download() article.parse() article.nlp() keywords = article.keywords for keyword in keywords: if keyword in junk_keywords: return True return False python from newspaper import Article def categorize_article(url): article = Article(url) article.download() article.parse() article.nlp() keywords = article.keywords categories = { } for category, keywords_list in categories.items(): for keyword in keywords: if keyword in keywords_list: return category


上一篇:
下一篇:
切换中文