Skip to content

Instantly share code, notes, and snippets.

@JarrydWannenburg
Last active September 3, 2022 17:01
Show Gist options
  • Save JarrydWannenburg/8389406001f6af8e4e06f1314781051e to your computer and use it in GitHub Desktop.
Save JarrydWannenburg/8389406001f6af8e4e06f1314781051e to your computer and use it in GitHub Desktop.
Google_News_Extraction_Article
# installations
## Spacy
pip install -U pip setuptools wheel
pip install -U spacy
python -m spacy download en_core_web_sm
## NewsAPI
pip install newsapi-python
## Newspaper3k
pip install newspaper3k
## TextBlob
pip install -U textblob
# loading libraries
from newspaper import Article
from newsapi import NewsApiClient
import pandas as pd
from textblob import TextBlob
import spacy
# Create our nlp object using the small class. While it's not as accurate as the large class, it is much more efficent
# and plenty accurate for this demo.
import en_core_web_sm
nlp = spacy.load("en_core_web_sm")
# Read in key
with open("NewsAPI_key.txt", 'r') as f:
key = f.read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment