Created
May 5, 2016 18:20
-
-
Save devStepsize/74880d3e61037df9d8522aa0bb258bea to your computer and use it in GitHub Desktop.
Get some cleaned text from a given webpage using AlchemyAPI.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
endpoint = "http://gateway-a.watsonplatform.net/calls/url/URLGetText" | |
parameters = { | |
'apikey': API_KEY, | |
'outputMode': 'json', | |
'url': 'http://techcrunch.com/' | |
} | |
r = requests.get(endpoint, params=parameters) | |
if r.status_code == 200: | |
resp = r.json() | |
# Cleaned text extracted from the website, no adverts :) | |
keywords = resp.get('text') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment