Skip to content

Instantly share code, notes, and snippets.

@danvbe
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danvbe/ce421fb469d9f5345456 to your computer and use it in GitHub Desktop.
Save danvbe/ce421fb469d9f5345456 to your computer and use it in GitHub Desktop.
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