Last active
August 29, 2015 14:03
-
-
Save danvbe/ce421fb469d9f5345456 to your computer and use it in GitHub Desktop.
Use Diffbot to extract the pubdate of an article page from Python?
This file contains hidden or 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 urllib2 | |
import json | |
url = "http://api.diffbot.com/v3/article?token=[your_token_here]&url=http%3A%2F%2Fblog.diffbot.com%2Fdiffbots-new-product-api-teaches-robots-to-shop-online%2F&fields=date" | |
req = urllib2.Request(url) | |
opener = urllib2.build_opener() | |
f = opener.open(req) | |
json = json.loads(f.read()) | |
print json['objects'][0]['date'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment