Created
December 23, 2014 11:49
-
-
Save h2rd/2e5ac2617a4ebd814a54 to your computer and use it in GitHub Desktop.
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
| #!/usr/bin/env python | |
| # coding: utf8 | |
| from __future__ import print_function | |
| import requests | |
| URL = 'https://graph.facebook.com/?ids=%s'; | |
| def get_url_data(url): | |
| r = requests.get(URL % (url,)) | |
| if 200 != r.status_code: return None | |
| return r.json()[url] | |
| if __name__ == '__main__': | |
| assert get_url_data('https://www.facebook.com/cocacola')['id'] == '40796308305' | |
| assert get_url_data('https://www.facebook.com/dresslikeaparisian?fref=ts')['id'] == '1384540595120471' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment