Skip to content

Instantly share code, notes, and snippets.

@danvbe danvbe/diffbot.py
Last active Aug 29, 2015

Embed
What would you like to do?
Use Diffbot to extract the pubdate of an article page from Python?
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
You can’t perform that action at this time.