├── 2015_or_Older_SocialMediaAPI ├── API-Vine │ ├── Example │ │ └── README.md │ ├── Technical-Document │ │ └── README.md │ └── README.md ├── underConstruction │ ├── IntegrationAPI │ │ ├── pythonAPI │ │ │ ├── GeoMongo │ │ │ │ ├── __init__.py │ │ │ │ ├── README.md │ │ │ │ ├── importShapefile.py │ │ │ │ └── GeoMongo.py │ │ │ ├── DataFactory │ │ │ │ ├── __init__.py │ │ │ │ ├── README.md │ │ │ │ ├── Shapefile.py │ │ │ │ └── DataTable.py │ │ │ ├── SocialMedia │ │ │ │ ├── __init__.py │ │ │ │ └── README.md │ │ │ ├── GeocodingEngine │ │ │ │ ├── __init__.py │ │ │ │ ├── README.md │ │ │ │ └── Geocoder.py │ │ │ └── Twitter │ │ │ │ └── twitterAPI.py │ │ └── README.md │ └── API-Yelp │ │ └── README.md ├── API-Panoramio │ ├── README.md │ └── TechnicalDocument │ │ └── Panoramio API.docx ├── old │ ├── Technical-Document │ │ ├── example.docx │ │ └── README.md │ ├── Example │ │ └── README.md │ └── README.md ├── API-Flickr │ ├── TechnicalDocument │ │ └── Flickr API_.docx │ ├── Example │ │ ├── flickr.htm │ │ ├── instagram.htm │ │ └── instagramFB.htm │ └── README.md ├── API-Youtube │ ├── TechnicalDocument │ │ └── YouTube_API.docx │ ├── old │ │ ├── Technical-Document │ │ │ ├── example.docx │ │ │ └── README.md │ │ ├── Example │ │ │ └── README.md │ │ └── README.md │ ├── README_backup.md │ ├── Example │ │ └── youtube.py │ └── README.md ├── API-Facebook │ ├── old │ │ ├── Technical-Document │ │ │ ├── example.docx │ │ │ └── README.md │ │ ├── Example │ │ │ └── README.md │ │ └── README.md │ ├── Example │ │ └── facebook.py │ └── README.md ├── API-Instagram │ ├── TechnicalDocument │ │ └── Instagram API_.docx │ ├── Example │ │ ├── flickr.htm │ │ ├── instagram.htm │ │ └── instagramFB.htm │ └── README.md ├── API-GooglePlaces │ ├── TechnicalDocument │ │ └── Tech-GooglePlace API.docx │ ├── README.md │ └── Example │ │ └── index.html ├── API-Foursquare │ ├── Technical-Document │ │ ├── Tech-Doc-FQ-API-02082015.docx │ │ └── README.md │ ├── Example │ │ ├── 01-Python-example.py │ │ ├── README.md │ │ └── 02-Webpage-example.html │ └── README.md ├── API-Locu │ ├── TechnicalDocument │ │ └── Technical_Document_LocuAPI_01192015.docx │ └── README.md ├── API-Twitter │ ├── Twitter_searchAPI_DEMO.py │ └── README.md ├── Example │ └── facebook.py └── README.md ├── 2024_New_SocialMediaAPI └── SocialMedia-Data-Collection-HDMA-Technical_Document.docx └── README.md /2015_or_Older_SocialMediaAPI/API-Vine/Example/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Vine/Technical-Document/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/GeoMongo/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/DataFactory/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/SocialMedia/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/GeocodingEngine/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/API-Yelp/README.md: -------------------------------------------------------------------------------- 1 | # HDMA-SocialMediaAPI 2 | Social Media API 3 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/README.md: -------------------------------------------------------------------------------- 1 | # HDMA-SocialMediaAPI 2 | Social Media API 3 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Panoramio/README.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ##Panoramio API by HDMA 3 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/GeocodingEngine/README.md: -------------------------------------------------------------------------------- 1 | Geocoding Engine 2 | ========= 3 | 4 | API for geocoding 5 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/old/Technical-Document/example.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HDMA-SDSU/HDMA-SocialMediaAPI/HEAD/2015_or_Older_SocialMediaAPI/old/Technical-Document/example.docx -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Flickr/TechnicalDocument/Flickr API_.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HDMA-SDSU/HDMA-SocialMediaAPI/HEAD/2015_or_Older_SocialMediaAPI/API-Flickr/TechnicalDocument/Flickr API_.docx -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Youtube/TechnicalDocument/YouTube_API.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HDMA-SDSU/HDMA-SocialMediaAPI/HEAD/2015_or_Older_SocialMediaAPI/API-Youtube/TechnicalDocument/YouTube_API.docx -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Youtube/old/Technical-Document/example.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HDMA-SDSU/HDMA-SocialMediaAPI/HEAD/2015_or_Older_SocialMediaAPI/API-Youtube/old/Technical-Document/example.docx -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Facebook/old/Technical-Document/example.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HDMA-SDSU/HDMA-SocialMediaAPI/HEAD/2015_or_Older_SocialMediaAPI/API-Facebook/old/Technical-Document/example.docx -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Panoramio/TechnicalDocument/Panoramio API.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HDMA-SDSU/HDMA-SocialMediaAPI/HEAD/2015_or_Older_SocialMediaAPI/API-Panoramio/TechnicalDocument/Panoramio API.docx -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/DataFactory/README.md: -------------------------------------------------------------------------------- 1 | DataFactory 2 | ========= 3 | 4 | API for opening, reading, and converting data from SHP / GeoJSON / XLS / XML data formats 5 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/GeoMongo/README.md: -------------------------------------------------------------------------------- 1 | GeoMongo 2 | ========= 3 | 4 | API for attribute query, spatial query, simply geometry, save / update / delete files in MongoDB 5 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Instagram/TechnicalDocument/Instagram API_.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HDMA-SDSU/HDMA-SocialMediaAPI/HEAD/2015_or_Older_SocialMediaAPI/API-Instagram/TechnicalDocument/Instagram API_.docx -------------------------------------------------------------------------------- /2024_New_SocialMediaAPI/SocialMedia-Data-Collection-HDMA-Technical_Document.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HDMA-SDSU/HDMA-SocialMediaAPI/HEAD/2024_New_SocialMediaAPI/SocialMedia-Data-Collection-HDMA-Technical_Document.docx -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/SocialMedia/README.md: -------------------------------------------------------------------------------- 1 | SocialMedia 2 | ========= 3 | 4 | API for geting data from SocialMedia, including Twitter, Facebook, Linkedin, Youtube, Flickr........ 5 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Youtube/README_backup.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ##Introduction to Youtube Graph API 3 | ######*Project conducted by*: 4 | ######*Report prepared by*: 5 | 6 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-GooglePlaces/TechnicalDocument/Tech-GooglePlace API.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HDMA-SDSU/HDMA-SocialMediaAPI/HEAD/2015_or_Older_SocialMediaAPI/API-GooglePlaces/TechnicalDocument/Tech-GooglePlace API.docx -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Foursquare/Technical-Document/Tech-Doc-FQ-API-02082015.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HDMA-SDSU/HDMA-SocialMediaAPI/HEAD/2015_or_Older_SocialMediaAPI/API-Foursquare/Technical-Document/Tech-Doc-FQ-API-02082015.docx -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Locu/TechnicalDocument/Technical_Document_LocuAPI_01192015.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HDMA-SDSU/HDMA-SocialMediaAPI/HEAD/2015_or_Older_SocialMediaAPI/API-Locu/TechnicalDocument/Technical_Document_LocuAPI_01192015.docx -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Foursquare/Example/01-Python-example.py: -------------------------------------------------------------------------------- 1 | 2 | import foursquare 3 | 4 | my_Client_id = 'your Client ID' 5 | my_Client_secret = 'your Client Secret' 6 | 7 | client = foursquare.Foursquare(client_id = my_Client_id, 8 | client_secret = my_Client_secret) 9 | 10 | client.venues.search(params={'ll': '32.775278, -117.072222', 11 | 'query': 'starbucks', 12 | 'radius': 1000}) 13 | 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ##Social Media API 3 | ######*Project conducted by*: San Diego State University 4 | 5 | #### Abstract 6 | This repository contains techical documents, exmaples, python codes of social media API. Besides providing the description of how to do a search by keyword, HDMA center at SDSU more focuses on how to do spatil query in Social media. For example, 7 | > 1) what parameters of spatial query are used in social media API (ex: lat, lng, geonames, or radius?) 8 | > 9 | > 2) what are returned formats (ex: json, xml, or geojson) 10 | > 11 | > 3) how to send a request by URL 12 | > 13 | > 4) how to write a simple python code to send a request 14 | > 15 | > 16 | 17 | 18 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/old/Example/README.md: -------------------------------------------------------------------------------- 1 | ######*Project conducted by*: San Diego State University 2 | ######*Content prepared by*: Jiue-An (Jay) Yang @ San Diego State University 3 | 4 | --- 5 | 6 | ## Examples 7 | This section contains two examples using the Foursquare API: 8 | 1. Python-based script to search and get Foursquare venues. 9 | 2. Web-based interface to search and show Foursquare venues. 10 | 11 | --- 12 | 13 | ##### 1. _Python-example.py_ 14 | This is a simple example of how to connect to the Foursquare API with your Python script. You can change the search parameters and retrieve Foursquare venues in a JSON (JavaScript Object Notation) format. 15 | 16 | ##### 2. _Webpage-example.html_ 17 | This is a simple example of how to connect to the Foursquare API in a webpage. You can change the search parameters and retrieve Foursquare venues in a JSON (JavaScript Object Notation) format. 18 | 19 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Facebook/old/Example/README.md: -------------------------------------------------------------------------------- 1 | ######*Project conducted by*: San Diego State University 2 | ######*Content prepared by*: Jiue-An (Jay) Yang @ San Diego State University 3 | 4 | --- 5 | 6 | ## Examples 7 | This section contains two examples using the Foursquare API: 8 | 1. Python-based script to search and get Foursquare venues. 9 | 2. Web-based interface to search and show Foursquare venues. 10 | 11 | --- 12 | 13 | ##### 1. _Python-example.py_ 14 | This is a simple example of how to connect to the Foursquare API with your Python script. You can change the search parameters and retrieve Foursquare venues in a JSON (JavaScript Object Notation) format. 15 | 16 | ##### 2. _Webpage-example.html_ 17 | This is a simple example of how to connect to the Foursquare API in a webpage. You can change the search parameters and retrieve Foursquare venues in a JSON (JavaScript Object Notation) format. 18 | 19 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Foursquare/Example/README.md: -------------------------------------------------------------------------------- 1 | ######*Project conducted by*: San Diego State University 2 | ######*Content prepared by*: Jiue-An (Jay) Yang @ San Diego State University 3 | 4 | --- 5 | 6 | ## Examples 7 | This section contains two examples using the Foursquare API: 8 | 1. Python-based script to search and get Foursquare venues. 9 | 2. Web-based interface to search and show Foursquare venues. 10 | 11 | --- 12 | 13 | ##### 1. _Python-example.py_ 14 | This is a simple example of how to connect to the Foursquare API with your Python script. You can change the search parameters and retrieve Foursquare venues in a JSON (JavaScript Object Notation) format. 15 | 16 | ##### 2. _Webpage-example.html_ 17 | This is a simple example of how to connect to the Foursquare API in a webpage. You can change the search parameters and retrieve Foursquare venues in a JSON (JavaScript Object Notation) format. 18 | 19 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Youtube/old/Example/README.md: -------------------------------------------------------------------------------- 1 | ######*Project conducted by*: San Diego State University 2 | ######*Content prepared by*: Jiue-An (Jay) Yang @ San Diego State University 3 | 4 | --- 5 | 6 | ## Examples 7 | This section contains two examples using the Foursquare API: 8 | 1. Python-based script to search and get Foursquare venues. 9 | 2. Web-based interface to search and show Foursquare venues. 10 | 11 | --- 12 | 13 | ##### 1. _Python-example.py_ 14 | This is a simple example of how to connect to the Foursquare API with your Python script. You can change the search parameters and retrieve Foursquare venues in a JSON (JavaScript Object Notation) format. 15 | 16 | ##### 2. _Webpage-example.html_ 17 | This is a simple example of how to connect to the Foursquare API in a webpage. You can change the search parameters and retrieve Foursquare venues in a JSON (JavaScript Object Notation) format. 18 | 19 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/DataFactory/Shapefile.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | class Shapefile(object): 4 | 5 | def __init__(self, fileName): 6 | import fiona 7 | 8 | self._source = fiona.open(fileName, "r") 9 | self._features = list(self._source) 10 | 11 | 12 | def getBounds(self): 13 | return self._source.bounds 14 | 15 | 16 | def getFeatures(self): 17 | return self._features 18 | 19 | def filterByProperty(self, 20 | #there's a SetAttributeFilter in OGR...use that? 21 | pass 22 | 23 | 24 | def filterByPolygon(self, properties): 25 | #?? 26 | pass 27 | 28 | 29 | def saveAsSHP(self, outName): 30 | output = fiona.open(outName, 'w', **self._source.meta) 31 | outpu.writerecords(list(self._features)) 32 | 33 | 34 | def saveAsGeoJSON(self, outName): 35 | import json 36 | 37 | featureCollection = dict(type="FeatureCollection", features=self._features, crs={}) 38 | 39 | out = open(outName, "w") 40 | out.write(json.dumps(featureCollection)) 41 | 42 | @classmethod 43 | def saveGeoJSONFeatures(features): 44 | pass 45 | 46 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Twitter/Twitter_searchAPI_DEMO.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Credit to the official tweepy example 3 | ''' 4 | 5 | import tweepy, json 6 | # == OAuth Authentication == 7 | 8 | # The consumer keys can be found on your application's Details 9 | # page located at https://dev.twitter.com/apps (under "OAuth settings") 10 | consumer_key="your consumer_key" 11 | consumer_secret="your consumer_secret" 12 | 13 | # The access tokens can be found on your applications's Details 14 | # page located at https://dev.twitter.com/apps (under "Your access token") 15 | access_token="your access_token" 16 | access_token_secret="your access_token_secret" 17 | 18 | auth = tweepy.OAuthHandler(consumer_key, consumer_secret) 19 | auth.secure = True 20 | auth.set_access_token(access_token, access_token_secret) 21 | 22 | # Authenticate 23 | api = tweepy.API(auth, parser=tweepy.parsers.JSONParser()) 24 | 25 | # Call the search function with selected parameters 26 | results = api.search(q="coffee", geocode = "32.774575,-117.072404,5mi", count=2) 27 | 28 | # display the returned results, using json.dumps for prettier display 29 | print json.dumps(results, indent =4) -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/old/Technical-Document/README.md: -------------------------------------------------------------------------------- 1 | ######*Project conducted by*: San Diego State University 2 | ######*Content prepared by*: Jiue-An (Jay) Yang @ San Diego State University 3 | 4 | --- 5 | 6 | ## Technical Document 7 | 8 | This technical note introduces the Foursquare API, which allows developer to connect to the Foursquare database for retrieval of users and venues information. This technical note covers some details about using the API, from getting started with applying the API keys to using the API method and retrieving data. 9 | 10 | There are many methods can be used from an endpoint application, however, this technical note will only focus on how to search and obtain information about venues with spatial parameters. The data retrieved from Foursquare with the API has potential to be used for mapping and analyzing the accessibility to food. 11 | 12 | This technical note covers the following items: 13 | * Sign up for Foursquare account 14 | * Register your Foursquare application 15 | * Search for a Starbucks venue within 1000 meters radius of the San Diego State university. 16 | 17 | --- 18 | 19 | Download the [technical note](https://github.com/HDMA-SDSU/HDMA-SocialMediaAPI/blob/dev/API-Foursquare/Tech_Document/Tech-Doc-FQ-API-02082015.docx?raw=true) for full content. -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Facebook/old/Technical-Document/README.md: -------------------------------------------------------------------------------- 1 | ######*Project conducted by*: San Diego State University 2 | ######*Content prepared by*: Jiue-An (Jay) Yang @ San Diego State University 3 | 4 | --- 5 | 6 | ## Technical Document 7 | 8 | This technical note introduces the Foursquare API, which allows developer to connect to the Foursquare database for retrieval of users and venues information. This technical note covers some details about using the API, from getting started with applying the API keys to using the API method and retrieving data. 9 | 10 | There are many methods can be used from an endpoint application, however, this technical note will only focus on how to search and obtain information about venues with spatial parameters. The data retrieved from Foursquare with the API has potential to be used for mapping and analyzing the accessibility to food. 11 | 12 | This technical note covers the following items: 13 | * Sign up for Foursquare account 14 | * Register your Foursquare application 15 | * Search for a Starbucks venue within 1000 meters radius of the San Diego State university. 16 | 17 | --- 18 | 19 | Download the [technical note](https://github.com/HDMA-SDSU/HDMA-SocialMediaAPI/blob/dev/API-Foursquare/Tech_Document/Tech-Doc-FQ-API-02082015.docx?raw=true) for full content. -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Foursquare/Technical-Document/README.md: -------------------------------------------------------------------------------- 1 | ######*Project conducted by*: San Diego State University 2 | ######*Content prepared by*: Jiue-An (Jay) Yang @ San Diego State University 3 | 4 | --- 5 | 6 | ## Technical Document 7 | 8 | This technical note introduces the Foursquare API, which allows developer to connect to the Foursquare database for retrieval of users and venues information. This technical note covers some details about using the API, from getting started with applying the API keys to using the API method and retrieving data. 9 | 10 | There are many methods can be used from an endpoint application, however, this technical note will only focus on how to search and obtain information about venues with spatial parameters. The data retrieved from Foursquare with the API has potential to be used for mapping and analyzing the accessibility to food. 11 | 12 | This technical note covers the following items: 13 | * Sign up for Foursquare account 14 | * Register your Foursquare application 15 | * Search for a Starbucks venue within 1000 meters radius of the San Diego State university. 16 | 17 | --- 18 | 19 | Download the [technical note](https://github.com/HDMA-SDSU/HDMA-SocialMediaAPI/blob/dev/API-Foursquare/Tech_Document/Tech-Doc-FQ-API-02082015.docx?raw=true) for full content. -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Youtube/old/Technical-Document/README.md: -------------------------------------------------------------------------------- 1 | ######*Project conducted by*: San Diego State University 2 | ######*Content prepared by*: Jiue-An (Jay) Yang @ San Diego State University 3 | 4 | --- 5 | 6 | ## Technical Document 7 | 8 | This technical note introduces the Foursquare API, which allows developer to connect to the Foursquare database for retrieval of users and venues information. This technical note covers some details about using the API, from getting started with applying the API keys to using the API method and retrieving data. 9 | 10 | There are many methods can be used from an endpoint application, however, this technical note will only focus on how to search and obtain information about venues with spatial parameters. The data retrieved from Foursquare with the API has potential to be used for mapping and analyzing the accessibility to food. 11 | 12 | This technical note covers the following items: 13 | * Sign up for Foursquare account 14 | * Register your Foursquare application 15 | * Search for a Starbucks venue within 1000 meters radius of the San Diego State university. 16 | 17 | --- 18 | 19 | Download the [technical note](https://github.com/HDMA-SDSU/HDMA-SocialMediaAPI/blob/dev/API-Foursquare/Tech_Document/Tech-Doc-FQ-API-02082015.docx?raw=true) for full content. -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Youtube/Example/youtube.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Fetch youtube video urls with specific keyword mentioned. 4 | Maximum result can be 50 only. 5 | 6 | Get Your own access key 7 | 1) Goto https://console.developers.google.com/project 8 | 2) Create Project 9 | 3) Click on project 10 | 4) Click on APIs & auth 11 | 5) Click on Credentials 12 | 6) Copy yout API Key 13 | 14 | 15 | """ 16 | __author__ = "Sagar N Jha , Xinyue Ye " 17 | 18 | #import required modules 19 | import urllib.request as urllib2 20 | import json 21 | 22 | part = "snippet" #Snippet is part of the information that youtube api returns. 23 | search = "Cop" #Search is the keyword and you can try: prision, food,choc,baby,Polics,Cop 24 | maxresult = "50" #Please dont change this 25 | key= "your id" # Kindly use your own key and It might get expired. 26 | 27 | #Preparing URL to get data 28 | #url = "https://www.googleapis.com/youtube/v3/search?locationRadius=5&part=snippet&q=food&location=(37.42307%2C-122.08427)&key=AIzaSyAVROgy5P7_tkpdnphi1-VoxPU8t27knS0" 29 | url = "https://www.googleapis.com/youtube/v3/search?part="+part+"&q="+search+"&maxResults="+maxresult+"&key="+key 30 | 31 | #Getting Data 32 | json_obj = urllib2.urlopen(url) 33 | data = json.loads(json_obj.readall().decode()) 34 | json_obj.getcode 35 | 36 | 37 | #Publishing Data 38 | for i in range(int(maxresult)): 39 | print (data['items'][i]['snippet']['title']) 40 | print ("https://www.youtube.com/watch?v="+data['items'][i]['id']['videoId']) 41 | print ("-"*120) 42 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/Example/facebook.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | This code is prototype and has been configured for my account. 4 | It download the tweets that has some location shared in it. 5 | 6 | You need a token to run the script. 7 | Steps to get a token. 8 | 1) Goto https://developers.facebook.com/apps/ 9 | 2) Click on Tools & Support 10 | 3) Click on Graph API Explorer 11 | 4) Copy Access Token 12 | """ 13 | __author__ = "Sagar N Jha , Xinyue Ye " 14 | 15 | import facebook 16 | import requests 17 | 18 | def Statuses(): 19 | """ 20 | The token might get expired and use your own token. 21 | It will fetch status shared by you with some location information 22 | """ 23 | token = 'get your own token' 24 | 25 | user = 'me' 26 | graph = facebook.GraphAPI(token) 27 | profile = graph.get_object(user) 28 | status = graph.get_connections(profile['id'], 'statuses') 29 | 30 | # Wrap this block in a while loop so we can keep paginating requests until finished. 31 | print ("Location",19*' ' ,"Latitude",18 * ' ',"Longitude",15 *" " ,"Status") 32 | print ("-" * 122) 33 | while True: 34 | try: 35 | # Perform some action on each post in the collection we receive from facebook. 36 | 37 | for item in status['data']: 38 | 39 | if "place" in item.keys(): 40 | 41 | if "city" in item['place']['location']: 42 | 43 | city = item['place']['location']['city'] 44 | lat = item['place']['location']['latitude'] 45 | longi = item['place']['location']['longitude'] 46 | 47 | city = city + ' ' *(25-len(city)) 48 | lat = str(lat) + ' ' *(25-len(str(lat))) 49 | longi = str(longi) + ' ' *(25-len(str(longi))) 50 | 51 | if "message" in item.keys(): 52 | print (city,"|",lat,"|",longi,item['message']) 53 | else: 54 | print (city,"|",lat,"|",longi) 55 | 56 | print ("-" * 122) 57 | 58 | # Attempt to make a request to the next page of data, if it exists. 59 | status = requests.get(status['paging']['next']).json() 60 | except KeyError: 61 | # Break loop if no page is left to display items. 62 | break 63 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Facebook/Example/facebook.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | This code is prototype and has been configured for my account. 4 | It download the tweets that has some location shared in it. 5 | 6 | You need a token to run the script. 7 | Steps to get a token. 8 | 1) Goto https://developers.facebook.com/apps/ 9 | 2) Click on Tools & Support 10 | 3) Click on Graph API Explorer 11 | 4) Copy Access Token 12 | """ 13 | __author__ = "Sagar N Jha , Xinyue Ye " 14 | 15 | import facebook 16 | import requests 17 | 18 | def Statuses(): 19 | """ 20 | The token might get expired and use your own token. 21 | It will fetch status shared by you with some location information 22 | """ 23 | token = 'get your own token' 24 | 25 | user = 'me' 26 | graph = facebook.GraphAPI(token) 27 | profile = graph.get_object(user) 28 | status = graph.get_connections(profile['id'], 'statuses') 29 | 30 | # Wrap this block in a while loop so we can keep paginating requests until finished. 31 | print ("Location",19*' ' ,"Latitude",18 * ' ',"Longitude",15 *" " ,"Status") 32 | print ("-" * 122) 33 | while True: 34 | try: 35 | # Perform some action on each post in the collection we receive from facebook. 36 | 37 | for item in status['data']: 38 | 39 | if "place" in item.keys(): 40 | 41 | if "city" in item['place']['location']: 42 | 43 | city = item['place']['location']['city'] 44 | lat = item['place']['location']['latitude'] 45 | longi = item['place']['location']['longitude'] 46 | 47 | city = city + ' ' *(25-len(city)) 48 | lat = str(lat) + ' ' *(25-len(str(lat))) 49 | longi = str(longi) + ' ' *(25-len(str(longi))) 50 | 51 | if "message" in item.keys(): 52 | print (city,"|",lat,"|",longi,item['message']) 53 | else: 54 | print (city,"|",lat,"|",longi) 55 | 56 | print ("-" * 122) 57 | 58 | # Attempt to make a request to the next page of data, if it exists. 59 | status = requests.get(status['paging']['next']).json() 60 | except KeyError: 61 | # Break loop if no page is left to display items. 62 | break 63 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Vine/README.md: -------------------------------------------------------------------------------- 1 | # Vine-API 2 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 3 | ##Retrieve video and user data from Vine using third-party Vine API 4 | ######*Project conducted by*: San Diego State University 5 | ######*Report prepared by*: Ardeshir Beheshti (Department of Geography, San Diego State University) 6 | #### Abstract 7 | The following report is to explain the Vine API, which introduces and allows developers to work with the Vine database to obtain information (location, username, subtext, etc.) about the specific uploaded content. From using and understanding the API information to using API methods to acquire user information/data. 8 | 9 | #### 1. What is Vine? 10 | Vine is a mobile short-clip video sharing service which is giving the users an opportunity to record and share a six-second-long looping video clip. The general users of this application use it as a form of entertainment for their viewers (or followers). This app is not limited to just an entertainment service. https://en.wikipedia.org/wiki/Vine_(service) 11 | 12 | #### 2. What is Vine API? 13 | When a registered user publishes a video to Vine, it will appear in their profile and in the timelines of their followers. Videos can also be posted to Twitter and Facebook. The Vine API allows users to retrieve data from the service, including popular videos, user data, a user's timeline, videos matching a given tag, individual posts, and notifications. 14 | 15 | #### 3. Vine API Key 16 | Since Vine does not have their own API online, third-party users create their own API for searching the Vine database. Once you create an account, you can access all of the APIs along with their keys since these are not registered by the company. In this specific circumstance, you need to use this since the company did not provide their own API. These third-party APIs can be found on: https://market.mashape.com/dashboard 17 | 18 | #### 4. Using Unirest (third-party API) 19 | Unirest is a simplified, lightweight HTTP client library application. This application can be access Vine data base through Python 2.7 but nothing higher. Unirest can also be downloaded: https://pypi.python.org/pypi/Unirest/ 20 | 21 | #### 5. Market.mashape APIs 22 | Next, you go to https://market.mashape.com/community/vine-app giving you specific command strings to use on Unirest to find information on Vine users. Marketplace has codes written already: Curl, Java, Node, PHP, Pyhton, C#, Ruby, and .Net. 23 | 24 | #### 6. These next few sets of code are to show examples of the appropriate commands needed to get information. The first is just to show a user logging in: 25 | 26 | * The first commmand is a typical user login 27 | ![](http://imgur.com/YlgBPtF.jpg) 28 | 29 | 30 | * Now by using the Get command, we are able to track something like popular vines in the past 24 hours. Again, this is just another example of tagging and finding popular vines giving their location, description, longitude & latitude, username, and other social media websites it has been shared with. 31 | ![](http://imgur.com/kfQ5baN.jpg)![](http://imgur.com/sIkctlC.jpg) 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/DataFactory/DataTable.py: -------------------------------------------------------------------------------- 1 | ''' 2 | THIS IS A WORK IN PROGRESS!!! 3 | 4 | Example: 5 | 6 | from excelUtils import DataTableFactory 7 | table = DataTableFactory.getDataTable("c:\\Locations.xlsx") 8 | 9 | table.getRowsAsList() 10 | 11 | #or 12 | table = DataTableFactory.getDataTable(open("c:\\Locations.csv")) 13 | 14 | table.getRowsAsList() 15 | ''' 16 | 17 | 18 | 19 | class DataTable(object): 20 | 21 | def __init__(self, colNames, rows): 22 | 23 | if not colNames: 24 | raise Exception("Error: Must pass column names to constructor.") 25 | 26 | if not rows: 27 | raise Exception("Error: Must rows to constructor.") 28 | 29 | self._colNames = colNames 30 | self._rows = rows 31 | 32 | 33 | def getColumnNames(self): 34 | return self._colNames 35 | 36 | 37 | def getRowsAsList(self): 38 | return self._rows 39 | 40 | 41 | def getRowsAsJSON(self): 42 | results = [] 43 | 44 | for rowIndx in xrange(len(self._rows)): 45 | doc = {} 46 | 47 | for colIndx, colName in enumerate(self._colNames): 48 | formattedName = colName.strip().replace(" ", "_") 49 | doc[formattedName] = self._rows[rowIndx][colIndx] 50 | 51 | results.append(doc) 52 | 53 | return results 54 | 55 | 56 | class DataTableFactory: 57 | EXCEL_EXTENSIONS = ('XLSX', 'XLS') 58 | CSV_EXTENSIONS = ('TXT', 'CSV') 59 | VALID_EXTENSIONS = EXCEL_EXTENSIONS + CSV_EXTENSIONS 60 | 61 | 62 | @staticmethod 63 | def getDataTable(fileName=None, fileStream=None, opts={}): 64 | ''' 65 | Parses CSV or Excel data and returns a DataTable object. 66 | Note that a file name must be passed. If no fileStream is passed, 67 | it will open a file using the fileName parameter. 68 | ''' 69 | 70 | if not fileName: 71 | raise Exception("Error: Must pass a file name.") 72 | 73 | if fileName and not fileStream: 74 | try: 75 | fileStream = open(fileName, "rb") 76 | except Exception, e: 77 | raise e 78 | 79 | ext = fileName.split('.')[-1].upper() 80 | 81 | if ext not in DataTableFactory.VALID_EXTENSIONS: 82 | raise Exception("Error: File must be one of the following types: %s" % ', '.join(DataTableFactory.VALID_EXTENSIONS)) 83 | 84 | colNames = [] 85 | rows = [] 86 | 87 | if ext in DataTableFactory.EXCEL_EXTENSIONS: 88 | from xlrd import open_workbook 89 | 90 | output = fileStream.read() 91 | workbook = open_workbook(file_contents=output) 92 | sheet = workbook.sheet_by_index(0) 93 | 94 | colNames = [ sheet.cell_value(0, col).lower() for col in xrange(sheet.ncols) ] 95 | 96 | for rowIndx in xrange(1, sheet.nrows): 97 | rows.append([ sheet.cell_value(rowIndx, colIndx) for colIndx in xrange(len(colNames)) ]) 98 | 99 | else: 100 | import csv 101 | 102 | delimiter = opts.get('delimiter', ',') 103 | quotechar = opts.get('quotechar', '"') 104 | 105 | reader = csv.reader(fileStream, delimiter=delimiter, quotechar=quotechar) 106 | 107 | data = [ row for row in reader ] 108 | 109 | colNames = [col.lower().strip() for col in data[0]] 110 | rows = [ row for row in data[1:] ] 111 | 112 | return DataTable(colNames, rows) 113 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Flickr/Example/flickr.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | jQuery Flickr JSON call 7 | 8 | 40 | 80 | 81 | 82 |

FLICKR API

83 |
84 |

85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 |

93 |
94 |
95 | 96 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Instagram/Example/flickr.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | jQuery Flickr JSON call 7 | 8 | 40 | 80 | 81 | 82 |

FLICKR API

83 |
84 |

85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 |

93 |
94 |
95 | 96 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/GeocodingEngine/Geocoder.py: -------------------------------------------------------------------------------- 1 | import math 2 | import re 3 | import os 4 | 5 | CITIES_FILE = "uscities.txt" 6 | 7 | 8 | ''' 9 | CityGeocoder provides a way to geocode city names. 10 | It uses the GeoNames database. 11 | ''' 12 | class CityGeocoder(dict): 13 | 14 | def __init__(self, items = None, file=CITIES_FILE): 15 | super(CityGeocoder, self).__init__() 16 | 17 | self._loadFile(file) 18 | 19 | 20 | def _loadFile(self, file): 21 | COL_CITY = 0 22 | COL_ALT_NAMES = 1 23 | COL_LAT = 2 24 | COL_LON = 3 25 | 26 | cwd = os.path.dirname(__file__) 27 | path = cwd + '\\' + file 28 | 29 | f = open(path) 30 | lines = f.read().split('\n') 31 | 32 | for line in lines: 33 | cols = line.split('\t') 34 | names = [cols[COL_CITY]] 35 | names.extend(cols[COL_ALT_NAMES].split(',')) 36 | 37 | for name in names: 38 | key = name.lower().strip() 39 | #val = { 'name': cols[COL_CITY], 'coords': (float(cols[COL_LAT]), float(cols[COL_LON])) } 40 | val = (cols[COL_CITY], (float(cols[COL_LAT]), float(cols[COL_LON]))) 41 | self.__setitem__(key, val) 42 | 43 | 44 | def lookup(self, location): 45 | ''' 46 | lookup(location): 47 | Returns tuple of the city name and the coordinates. 48 | If the location can't be located, returns ('None', (0.0, 0.0) 49 | ''' 50 | 51 | noplace = (None, (None, None)) 52 | 53 | if not location or type(location) is not str: 54 | return noplace 55 | 56 | loc = location.lower().strip() 57 | 58 | if loc in self: 59 | return self.__getitem__(loc) 60 | 61 | token = loc.split(",")[0].strip() 62 | if token in self: 63 | return self.__getitem__(token) 64 | 65 | firstWord = re.findall(r'\w+', loc)[0] 66 | if firstWord in self: 67 | return self.__getitem__(firstWord) 68 | 69 | return noplace 70 | 71 | 72 | ''' 73 | AddressGeocoder provides a API for geocoding address information. 74 | Note: Currently, this is just a wrapper for the geopy geocoders, 75 | but we can use the same API when our own custom geocoder is set up. 76 | ''' 77 | class AddressGeocoder(object): 78 | 79 | def __init__(self, username=None, password=None, geocoderName="GEOCODERDOTUS"): 80 | 81 | import geopy 82 | 83 | geocoderName = geocoderName.upper() 84 | 85 | if geocoderName == "GEOCODERDOTUS": 86 | if username and password: 87 | #self._geocoder = geopy.geocoders.GeocoderDotUS(username, password) 88 | #NOTE: I don't believe geopy handles Geocoder.US usernames and passwords 89 | #properly, so just calling without these for now... 90 | self._geocoder = geopy.geocoders.GeocoderDotUS() 91 | else: 92 | self._geocoder = geopy.geocoders.GeocoderDotUS() 93 | else: 94 | self._geocoder = geopy.geocoders.GoogleV3() 95 | 96 | def lookup(self, location): 97 | noplace = (None, (None, None)) 98 | 99 | #different geocoder return different values 100 | #some return a list of possible matches, other 101 | #just return the best match 102 | coded = self._geocoder.geocode(location, exactly_one=False) 103 | if coded and coded is list: 104 | place, (lat, lng) = coded[0] 105 | if place and lat and lng: 106 | return (place, (lat, lng)) 107 | else: 108 | return noplace 109 | elif coded: 110 | place, (lat, lng) = coded 111 | if place and lat and lng: 112 | return (place, (lat, lng)) 113 | else: 114 | return noplace 115 | 116 | return noplace 117 | 118 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Flickr/README.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ##Retrieve Photo Data from Flickr Using Flickr API - NIH Proposal for Food Environment 3 | ######*Project conducted by*: San Diego State University 4 | ######*Report prepared by*: Yi-ting Chuang (Department of Geography, San Diego State University) 5 | #### Abstract 6 | This technical note introduces how to retrieve food photos at Downtown San Diego from Flickr by using Flickr API. This notes searched photos by setting longitude, latitude and radius arguments. 7 | 8 | 9 | #### 1. What is Flickr? 10 | Flickr is an image hosting and video hosting website, and web services. Users can not only share and embed personal photographs but also effectively attend an online community. The service is widely used by photo researchers and by bloggers to host images that they embed in blogs and social media. (http://en.wikipedia.org/wiki/Flickr) 11 | #### 2. What is Flickr API? 12 | Registered users can search photos and related information according to different arguments by using Flickr API. 13 | #### 3. Does the API need a key? 14 | Yes, before utilizing Flickr API, developers need to get an access key and secret code for calling methods of Flickr API. Go here: https://www.youtube.com/watch?v=Lq1XRx6dsDU. 15 | #### 4. How to find photos for specific geographic areas? (e.g. Downtown San Diego) 16 | flickr.photos.search() method allows users to search photos taken at specific locations. Parameters in this method include: 17 | Tags: A comma-delimited list of tags. Photos with one or more of the tags listed will be returned. You can exclude results that match a term by prepending it with a - character. (e.g. Food) 18 | Lon: A valid longitude, in decimal format, for doing radial geo queries. (e.g. -117.161) 19 | Lat: A valid latitude, in decimal format, for doing radial geo queries. (e.g. 32.726) 20 | Radius: A valid radius used for geo queries, greater than zero and less than 20 miles (or 32 kilometers), for use with point-based geo queries. The default value is 5 (km). 21 | Other parameters: https://www.flickr.com/services/api/flickr.photos.search.html 22 | #### 5. The following is an example of photos with “food” tag at Downtown San Diego (latitude: 32.715754; longitude: -117.161093) with 5 kilometers radius. 23 | 24 | ``` 25 | Photo Data: 26 | "photo": [ 27 | { "id": "16002140699", "owner": "31911001@N00", "secret": "262c519825", "server": "8649", "farm": 9, "title": "Chilaquiles WTF", "ispublic": 1, "isfriend": 0, "isfamily": 0 }, 28 | { "id": "15241138255", "owner": "15474023@N03", "secret": "960b0d8a36", "server": "5552", "farm": 6, "title": "IMG_3408", "ispublic": 1, "isfriend": 0, "isfamily": 0 }, 29 | { "id": "15128197056", "owner": "65172614@N06", "secret": "f6d8f31795", "server": "3850", "farm": 4, "title": "Croque monsieur", "ispublic": 1, "isfriend": 0, "isfamily": 0 }, 30 | { "id": "14863357020", "owner": "34128007@N04", "secret": "ba4e3d20d1", "server": "3879", "farm": 4, "title": "Fruit Tart", "ispublic": 1, "isfriend": 0, "isfamily": 0 }, 31 | { "id": "14813732619", "owner": "7183730@N06", "secret": "80a732dac5", "server": "5552", "farm": 6, "title": "Scallop omelette", "ispublic": 1, "isfriend": 0, "isfamily": 0 }, 32 | { "id": "14813823548", "owner": "7183730@N06", "secret": "984a519a95", "server": "3871", "farm": 4, "title": "", "ispublic": 1, "isfriend": 0, "isfamily": 0 } 33 | ``` 34 | 35 | Flickr photo format: https://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg 36 | 37 | 38 | This note only utilizes flickr.photos.search() method to search photos. For more information (e.g. date, place id, and size) of photos, go to [https://www.flickr.com/services/api/](https://www.flickr.com/services/api/). 39 | 40 | ####Demo site: http://vision.sdsu.edu/ychuang/Flickr_InstagramAPI/socialMedia_API.html 41 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Flickr/Example/instagram.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery Instagram JSON call 6 | 7 | 66 | 107 | 108 | 109 |

Instagram API

110 | 121 |
122 | 123 | 124 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Instagram/Example/instagram.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery Instagram JSON call 6 | 7 | 66 | 107 | 108 | 109 |

Instagram API

110 | 121 |
122 | 123 | 124 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-GooglePlaces/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ##Google Places API 5 | ######*Project conducted by*: San Diego State University 6 | ######*Report prepared by*: Chin-Te (Calvin) Jung (Department of Geography, San Diego State University) 7 | 8 | ## Abstract 9 | 10 | This report introduces the Google Places API, which allows developer to connect to the Google Places database for retrieval of place features (including more than 100 million businesses and points of interest that are updated frequently). This report covers details about using the API, from getting started with applying the API keys to using the API method and retrieving data. The data retrieved from Google Places with the API has potential to be used for mapping and analyzing accessibility to food. 11 | 12 | This report covers the following items: 13 | - Introduction of Google Places 14 | - Apply for Google Places API key 15 | - Import Google Places API into your Web applications 16 | - Search for a Starbucks venue within 1000 meters radius of a location. 17 | 18 | 19 | 20 | 21 | ## Website 22 | https://developers.google.com/places/javascript/ 23 | 24 | 25 | ## Introduction 26 | Google Places is the database which collects more than 100 million businesses and points of interest that are updated frequently through owner-verified listings and user-moderated contributions. The Google Places API is the application programming interface (API) developed by Google which we can use multi programming languages, including JavaScript, Java, or Object C, to query the database. This report only focuses on JavaScript (JS) programming language and uses JS to demonstrate how to query Google Places. 27 | 28 | The Google Places API for JS provides the following ways to conduct a search. 29 | - **getDetail** 30 | retrieves details about the place identified by the given placeId. 31 | - **nearbySearch** 32 | retrieves a list of places in a given area. 33 | - **radarSearch** 34 | similar to the nearBySearch but only include up to 200 places which are identifies only by their geographic coordinates and place_id. 35 | - **textSearch** 36 | similar to the nearBySearch but based on the comparison of keywords. If bounds or location+radius is provided in the search criteria, the reulsts will not restrict the results to places inside the area, only bias the response towards results near it. 37 | 38 | The information about a place can be retrieved in a search result, which is in JSON (JavaScript Object Notation) format. The information includes name, coordinates, description, addresses, phone number, websites, time zone, photos, price level (from free to very expensive), user reviews, ratings (from 1 to 5 stars), and types (such as restaurant or establishment). 39 | 40 | 41 | 42 | ## The Google Places API Key 43 | 44 | To get started, the first thing to do is to get an API key for Google Places. The API key uses Google Maps API Key. If you already have Google Maps API key, you can skip this part. If you don’t have or don’t know how to get one, please follow these steps. 45 | 1. Go to Google Developers Console (https://console.developers.google.com) 46 | 2. Create or select a project 47 | 3. Activate the Google Maps JavaScript API under APIs 48 | 49 | 50 | 4. Get an API key by switching to credentials under APIs & auth. Create a new Browser key. 51 | 52 | 5. Give a name for the browser key and press Create button 53 | 6. You will get an API key. 54 | 7. Please remember that the limit for free usage of Google Places API is 150,000 request per 24 hour period. 55 | 56 | 57 | 58 | ## Import Goolge Places API into your Web applications 59 | 60 | 1. After your get the Google API key, you need to import Google Places API into your Web application with the API key. 61 | ```sh 62 | 63 | ``` 64 | 65 | 2. You need to init a Google Maps object first to have a google Place object. 66 | ```sh 67 | var map=new google.maps.Map(document.getElementById("domID_MAP")); 68 | var googlePlace=new google.maps.places.PlacesService(map) 69 | ``` 70 | 3. Make a query request to Google Places. For example, if we would like to search Startbucks nearby a certain location with latitude and longitude. We can use “nearbySearch” function to do the query. The results will be responded in the callback function. Then you can continue to parse results and visualize them. 71 | ```sh 72 | googlePlace.nearbySearch({ 73 | location: new google.maps.LatLng(lat, long), 74 | radius: 100 //unit: meter 75 | types: [“restaurant”] //categories 76 | name: “starbucks” //query name 77 | }, 78 | function(results){ 79 | //callback function 80 | 81 | 82 | }); 83 | ``` 84 | 85 | 4. Please see more details in [the demo site](http://vision.sdsu.edu/ychuang/Flickr_InstagramAPI/socialMedia_API.html]) or see the codes in the [Github](https://github.com/HDMA-SDSU/HDMA-SocialMediaAPI/blob/dev/API-GooglePlaces/Example/index.html). 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Foursquare/README.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ######*Project conducted by*: San Diego State University 3 | ######*Content prepared by*: Jiue-An (Jay) Yang @ San Diego State University 4 | 5 | --- 6 | 7 | ## Working with the Foursquare API (using Python) 8 | 9 | --- 10 | 11 | #### Introduction 12 | Welcome to the section about the Foursquare API. 13 | Lets start with the Foursquare API 101, and then you can explore more about using the API by reading our technical note or check out our examples. 14 | 15 | --- 16 | 17 | #### Foursquare API 101 18 | 19 | ##### 1. What is Foursquare ? 20 | 21 | >[Foursquare](https://foursquare.com/) is a local search and discovery service mobile app which provides a personalised local search experience for its users. By taking into account the places a user goes, the things they have told the app that they like, and the other users whose advice they trust, Foursquare aims to provide highly personalised recommendations of the best places to go around a user's current location. 22 | 23 | ##### 2. What is Foursquare API ? 24 | 25 | >The [Foursquare API](https://developer.foursquare.com/start) (Application Programming Interface) allows developer to connect to the Foursquare database. Developers can retrieve users and venues information or interact with Foursquare users and merchants. 26 | 27 | ##### 3. Is the Foursquare Free ? 28 | 29 | >**Yes**, using the API is free. However, you will need to sign-up for a Foursquare account and then register your account to the [Foursquare for Developer](https://developer.foursquare.com/) to create your application. The registered application will grant you API keys that you need to interact with the Foursquare database. 30 | 31 | ##### 4. To search for Foursquare Venues, what parameters I can use ? 32 | 33 | >The Search Venues method allow you to use parameters such as *search center* (latitude & longitude), *radius*, *venue name* ...etc. 34 | 35 | ##### 5. What does the response looks like ? 36 | 37 | >Foursquare API responses are in JSON (JavaScript Object Notation) format. Following is an example of one Starbucks venue that is located at the San Diego State University. 38 | 39 | ```json 40 | { 41 | "venues": [ 42 | { 43 | "hasMenu": true, 44 | "verified": false, 45 | "name": "Starbucks", 46 | "referralId": "v-1423476221", 47 | "url": "http://www.starbucks.com", 48 | "menu": { 49 | "url": "https://foursquare.com/v/starbucks/4b832dc7f964a52000fc30e3/menu", 50 | "mobileUrl": "https://foursquare.com/v/4b832dc7f964a52000fc30e3/device_menu", 51 | "type": "Menu", 52 | "anchor": "View Menu", 53 | "label": "Menu" 54 | }, 55 | "contact": { 56 | "phone": "6195947733", 57 | "twitter": "starbucks", 58 | "formattedPhone": "(619) 594-7733" 59 | }, 60 | "location": { 61 | "distance": 202, 62 | "city": "San Diego", 63 | "cc": "US", 64 | "country": "United States", 65 | "postalCode": "92115", 66 | "state": "CA", 67 | "formattedAddress": [ 68 | "5500 Campanile Dr", 69 | "San Diego, CA 92115", 70 | "United States" 71 | ], 72 | "address": "5500 Campanile Dr", 73 | "lat": 32.77626, 74 | "lng": -117.07404 75 | }, 76 | "stats": { 77 | "tipCount": 5, 78 | "checkinsCount": 1152, 79 | "usersCount": 338 80 | }, 81 | "id": "4b832dc7f964a52000fc30e3", 82 | "categories": [ 83 | { 84 | "pluralName": "Coffee Shops", 85 | "primary": true, 86 | "name": "Coffee Shop", 87 | "shortName": "Coffee Shop", 88 | "id": "4bf58dd8d48988d1e0931735", 89 | "icon": { 90 | "prefix": "https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_", 91 | "suffix": ".png" 92 | } 93 | } 94 | ] 95 | } 96 | ] 97 | } 98 | ``` 99 | 100 | 101 | --- 102 | 103 | #### Getting Started ! 104 | 105 | + Kick start and learn how to use the API by follow our *[technical note](https://github.com/HDMA-SDSU/HDMA-SocialMediaAPI/tree/dev/API-Foursquare/Tech_Document)* 106 | + Or check out our *[examples](https://github.com/HDMA-SDSU/HDMA-SocialMediaAPI/tree/dev/API-Foursquare/Example)* of a web search interface and a python script 107 | + For detailed methods and documentation of the Foursquare API, please go to the official [Foursquare for Developer](https://developer.foursquare.com/) page 108 | 109 | --- 110 | 111 | #### Folder Structure 112 | - Examples 113 | 1. Web Search Interface Example 114 | 2. Python Script Example 115 | - Technical Document 116 | 1. Technical Note on Working with Foursquare API (in .docx format) -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/GeoMongo/importShapefile.py: -------------------------------------------------------------------------------- 1 | ''' 2 | This script will import features from a shapefile into MongoDB as GeoJSON objects. 3 | The user must specify both the shapefile to be imported and the name of the collection 4 | where the GeoJSON output will be stored. 5 | 6 | Usage: python importShapefile.py [Shapefile Path] [Collection Name] 7 | 8 | EX: python importShapefile.py counties.shp GeoJSONCounties 9 | 10 | 11 | NOTE: Any feature that contains multiple polygons (ie, a MultiPolygon) will be split up, 12 | since MongoDB does not allow for MultiPolygons. For instance, a MultiPolygon containing 13 | three polygons will be split into three separate GeoJSON objects. These objects are 14 | given an extra property called "groupId" that links these objects together. 15 | ''' 16 | 17 | 18 | import traceback 19 | import ogr, json 20 | from pymongo import MongoClient 21 | 22 | 23 | DATABASE_NAME = "test" 24 | collection = None 25 | 26 | 27 | # This function converts a string to an integer or float (where possible) 28 | def convertIfNumeric(val): 29 | def isFloat(string): 30 | try: 31 | float(string) 32 | return True 33 | except: 34 | return False 35 | 36 | if hasattr(val, 'isdigit') and val.isdigit(): 37 | return int(val) 38 | elif isFloat(val): 39 | return float(val) 40 | 41 | return val 42 | 43 | 44 | def makePolygonValid(geometry): 45 | from shapely.geometry import mapping, shape 46 | dirty = shape(geometry) 47 | clean = dirty.buffer(0.0) 48 | return mapping(clean) 49 | 50 | 51 | # This function takes a MultiPolygon GeoJSON object as an input 52 | # and splits it into a list of separate Polygons. 53 | def explodeMultiPolygon(geoJson): 54 | if not collection: 55 | return [] 56 | 57 | #get the next groupId available... 58 | groupId = len(collection.find().distinct("groupId")) + 1 59 | 60 | result = [] 61 | 62 | for coords in geoJson['geometry']['coordinates']: 63 | item = {} 64 | item['type'] = geoJson['type'] 65 | item['properties'] = geoJson['properties'] 66 | item['groupId'] = groupId 67 | item['geometry'] = { "type": "Polygon", "coordinates": coords } 68 | 69 | result.append(item) 70 | 71 | return result 72 | 73 | 74 | def main(fileName, collectionName, dbName=DATABASE_NAME): 75 | try: 76 | #set up database connection 77 | conn = MongoClient() 78 | global collection 79 | collection = conn[dbName][collectionName] 80 | 81 | #make sure the spatial index is created for GeoJSON 82 | collection.ensure_index([("geometry", "2dsphere")]) 83 | 84 | #open shapefile 85 | shp = ogr.Open(fileName) 86 | layer = shp.GetLayer(0) 87 | 88 | #keep track of successes and failures 89 | successCount = 0 90 | featureCount = 0 91 | failures = [] 92 | 93 | for fid in xrange(layer.GetFeatureCount()): 94 | try: 95 | feature = layer.GetFeature(fid) 96 | geoJson = json.loads(feature.ExportToJson()) 97 | 98 | #convert all strings to their numerical values (if applicable) 99 | for prop in geoJson['properties']: 100 | geoJson['properties'][prop] = convertIfNumeric(geoJson['properties'][prop]) 101 | 102 | #geoJson['properties']["center"] = [ float(geoJson['properties']['INTPTLON']), float(geoJson['properties']['INTPTLAT']) ] 103 | 104 | if not feature.geometry().IsValid(): 105 | print 'yo' 106 | geoJson['geometry'] = makePolygonValid(geoJson['geometry']) 107 | print 'no' 108 | 109 | #if this feature is a MultiPolygon, explode it into a group of Polygons 110 | if geoJson['geometry']['type'].upper() == "MULTIPOLYGON": 111 | multi = explodeMultiPolygon(geoJson) 112 | 113 | for item in multi: 114 | collection.insert(item) 115 | featureCount += 1 116 | 117 | else: 118 | if 'id' in geoJson: 119 | del geoJson['id'] 120 | 121 | collection.insert(geoJson) 122 | featureCount += 1 123 | 124 | successCount += 1 125 | 126 | if successCount % 250 == 0: 127 | print "Imported %d features!" % (successCount) 128 | 129 | except Exception, e: 130 | failures.append((fid, str(e))) 131 | 132 | conn.close() 133 | conn.disconnect() 134 | 135 | print "Imported %d features." % successCount 136 | print "Total (after multipolygons were split up): %d" % featureCount 137 | print "%d features could not be imported" % (len(failures)) 138 | 139 | if len(failures) > 0: 140 | val = raw_input("Would you like to see the error details (Y/N)?") 141 | 142 | if val.upper() == "Y": 143 | 144 | for fid, error in failures: 145 | print "-" * 60 146 | print "Feature ID: %d" % fid 147 | print error[:400] 148 | 149 | 150 | except Exception, e: 151 | print "Critial error occured! Aborting..." 152 | print str(e) 153 | print traceback.format_exc() 154 | 155 | 156 | 157 | if __name__ == "__main__": 158 | import sys 159 | 160 | args = sys.argv[1:] 161 | 162 | if len(args) < 2: 163 | print "Error! Requires two arguments: 1) A shapefile, and 2) A collection name\n" 164 | print "EX: python %s counties.shp geoJson_counties" % (__file__) 165 | exit() 166 | 167 | fileName = args[0] 168 | collectionName = args[1] 169 | 170 | main(fileName, collectionName) 171 | 172 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Instagram/README.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ##Retrieve Photo Data from Instagram Using Instagram API - NIH Proposal for Food Environment 3 | ######*Project conducted by*: San Diego State University 4 | ######*Report prepared by*: Yi-ting Chuang (Department of Geography, San Diego State University) 5 | #### Abstract 6 | This technical note introduces how to retrieve food photos at Downtown San Diego from Instagram by using Instagram API. This notes searched photos by setting location ids, based on longitude and latitude, and radius arguments. 7 | 8 | #### 1. What is Instagram? 9 | Instagram is an online mobile photo-sharing, video-sharing and social networking service that enables its users to take pictures and videos, and share them on a variety of social networking platforms, such as Facebook, Twitter, Tumblr and Flickr. A distinctive feature is that it confines photos to a square shape, similar to Kodak Instamatic and Polaroid images, in contrast to the 4:3 aspect ratio typically used by mobile device cameras. Users can also apply digital filters to their images. (http://en.wikipedia.org/wiki/Instagram) 10 | 11 | #### 2. What is Instagram API? 12 | Registered users can search photos and related information according to different arguments by using Instagram API. 13 | 14 | #### 3. Does the API need a key? 15 | Yes, before utilizing Instagram API, developers need to get an access key for calling methods of Instagram API. Go here: http://instagram.com/developer/authentication/. 16 | 17 | #### 4. How to find photos for specific geographic areas? (e.g. Downtown San Diego) 18 | Go to “Location Endpoints” on Instagram website: http://instagram.com/developer/endpoints/locations/. 19 | Note: Istagram API can only respond 20 location ids at a time. For getting more ids at a time, please utilize Facebook’s Graph API to get Facebook’s location ids and convert them into Instagram’s location ids. 20 | - The third method can get a list of Instagram’s location ids by setting: 21 | Lng: A valid longitude, in decimal format, for doing radial geo queries. (e.g. -117.161) 22 | Lat: A valid latitude, in decimal format, for doing radial geo queries. (e.g. 32.726) 23 | Distance: A valid radius used for geo queries, greater than zero and less than 5000m, for use with point-based geo queries. The default value is 1000m. **Note: Istagram API can only respond 20 location ids at a time. For getting more ids at a time, please utilize Facebook’s Graph API to get Facebook’s location ids and convert them into Instagram’s location ids.** 24 | 25 | - The second method can search photos based on: 26 | Location_id: Instagram location ids, which can be generated by using the third method. 27 | Other parameters: http://instagram.com/developer/endpoints/locations/ 28 | 29 | #### 5. The following is an example of photos with **“food”** tag at **Downtown San Diego (latitude: 32.715754; longitude: -117.161093)** with **5 kilometers** radius. 30 | Instagram Location IDs: 31 | ``` 32 | "data":[{"latitude":32.726005369,"id":"76449888","longitude":-117.16114532,"name":"Areta Crowell Center"}, 33 | {"latitude":32.725929,"id":"252182784","longitude":-117.160861,"name":"Sharp Rees-Stealy Medical Centers"}, 34 | {"latitude":32.726120597,"id":"254994208","longitude":-117.161077997,"name":"Mission Bay Park"}, 35 | {"latitude":32.725788399,"id":"14535462","longitude":-117.160915565,"name":"Hawthorn and 4th"}, 36 | {"latitude":32.726098621,"id":"451226492","longitude":-117.161246422,"name":"Sharp Rees Steely"}, 37 | {"latitude":32.725939694,"id":"394497","longitude":-117.161286506,"name":"Sharp Rees-Stealy Downtown San Diego"}, 38 | {"latitude":32.725735958,"id":"389099054","longitude":-117.161148371,"name":"Siti Medical Spa"}, 39 | {"latitude":32.72626119,"id":"5824990","longitude":-117.16079247,"name":"Sharp Rees-Steely Urgent Care"}, 40 | {"latitude":32.725645,"id":"14251612","longitude":-117.160856, 41 | ``` 42 | Photo data: 43 | ``` 44 | "data":[{"attribution":null,"tags":[],"type":"image","location":{"latitude":32.726120597,"name":"Mission Bay Park","longitude":-117.161077997,"id":254994208}, 45 | "comments":{"count":7,"data":[{"created_time":"1416796151","text":"\u270c\ufe0f\ud83d\ude4c\ud83d\udcaa\ud83d\udd1d","from":{"username":"nnectoux","profile_picture":"https:\/\/igcdn-photos-b-a.akamaihd.net\/hphotos-ak-xpa1\/t51.2885-19\/10632376_630528803732193_1124873594_a.jpg","id":"34891169","full_name":"Nelson Nectoux"},"id":"860470941825098012"}, 46 | {"created_time":"1416805872","text":"\ud83d\udc4f\ud83d\udc4f\ud83d\udc4f","from":{"username":"fsabbatini","profile_picture":"https:\/\/igcdn-photos-e-a.akamaihd.net\/hphotos-ak-xpf1\/t51.2885-19\/10693517_730206550394612_1811208857_a.jpg","id":"22278664","full_name":"Freddy Sabbatini"},"id":"860552490226540560"}, 47 | {"created_time":"1416807791","text":"@nnectoux amazinggg!! Foi demais hoje, energia mega positiva!","from":{"username":"carlamariazinha","profile_picture":"https:\/\/igcdn-photos-c-a.akamaihd.net\/hphotos-ak-xpa1\/t51.2885-19\/10729199_1493937554215498_1974034382_a.jpg","id":"30615503","full_name":"Carla Maria"},"id":"860568590456709165"}, 48 | {"created_time":"1416807824","text":"@fsabbatini at\u00e9 muito breve, sofri mas foi demais!!", 49 | ``` 50 | #### Limitation: 51 | A limitation of using Istagram API to search location ids is that it only responds 20 location ids at a time. If you want to get more location ids at once, you can utilize Graph API by Facebook to get a list of facebook_places_ids (500 data) and convert it into Instagram location ids by using “locations/search?facebook_places_id” method. You can get 500 Instagram location ids instead of 20. 52 | 53 | ####Demo site: http://vision.sdsu.edu/ychuang/Flickr_InstagramAPI/socialMedia_API.html 54 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Flickr/Example/instagramFB.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery Instagram JSON call 6 | 7 | 80 | 121 | 122 | 123 |

Instagram API

124 | 135 |
136 | 137 | 138 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Instagram/Example/instagramFB.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery Instagram JSON call 6 | 7 | 80 | 121 | 122 | 123 |

Instagram API

124 | 135 |
136 | 137 | 138 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/Twitter/twitterAPI.py: -------------------------------------------------------------------------------- 1 | class PathgeoTwitter: 2 | import sys 3 | from datetime import datetime 4 | 5 | 6 | 7 | ''' 8 | createXLSX: convert tweets array into xlsx file 9 | input 10 | 1. *tweets (array) 11 | 2. *cols (array): which columns in tweets you want to export 12 | 3. *outputPath (String) 13 | 4. *fileName (String): with XLSX extension, such as "test.xlsx" 14 | 5. ?keyword (string) 15 | 6. ?sheetTitle (string) 16 | return filepath (string) 17 | ''' 18 | def createXLSX(self, tweets, cols, outputPath, fileName, keyword=None, sheetTitle='Tweets'): 19 | from openpyxl import Workbook 20 | from BeautifulSoup import BeautifulSoup as BS 21 | 22 | 23 | try: 24 | book = Workbook() 25 | sheet = book.get_active_sheet() 26 | 27 | sheet.title = sheetTitle 28 | 29 | 30 | #create columns 31 | for indx, col in enumerate(cols): 32 | sheet.cell(row=0, column=indx).value = col.upper() 33 | 34 | 35 | #read tweets 36 | for rowIndx, tweet in enumerate(tweets): 37 | for colIndx, col in enumerate(cols): 38 | if col not in tweet: 39 | continue 40 | 41 | val = '' 42 | 43 | if col in ('urls', 'hashtags'): 44 | if 'entities' in tweet and col in tweet['entities'] and tweet['entities'][col]: 45 | if type(tweet['entities'][col][0]) in (str, unicode): 46 | val = ', '.join(tweet['entities'][col]) 47 | elif col == 'urls': 48 | val = ', '.join(map(lambda item: item['expanded_url'], tweet['entities'][col])) 49 | elif col == 'hashtags': 50 | val = ', '.join(map(lambda item: item['text'], tweet['entities'][col])) 51 | 52 | if col == 'is_retweet': 53 | val = '' if 'retweeted_id' not in tweet and 'user' not in tweet else bool(tweet.get('retweeted_id', None)) 54 | 55 | if col == 'retweeted_id': 56 | val = tweet.get('retweeted_id', '') 57 | 58 | if col == 'retweet_count': 59 | val = tweet.get('retweet_count', '') 60 | 61 | if col == 'time_zone' and 'user' in tweet: 62 | val = tweet['user'].get('time_zone', '') 63 | 64 | if col == 'followers_count' and 'user' in tweet: 65 | val = tweet['user'].get('followers_count', '') 66 | 67 | if col == 'friends_count' and 'user' in tweet: 68 | val = tweet['user'].get('friends_count', '') 69 | 70 | if col == 'statuses_count' and 'user' in tweet: 71 | val = tweet['user'].get('statuses_count', '') 72 | 73 | if col == 'language': 74 | val = tweet.get('lang', None) 75 | val = val or tweet.get('iso_language_code', None) 76 | 77 | if col == 'location': 78 | if 'location' in tweet: 79 | val = tweet[col] 80 | elif 'user' in tweet and 'location' in tweet['user']: 81 | val = tweet['user']['location'] 82 | 83 | if col == 'from_user': 84 | if 'from_user' in tweet: 85 | val = tweet[col] 86 | elif 'user' in tweet and type(tweet['user']) is dict and 'screen_name' in tweet['user']: 87 | val = tweet['user']['screen_name'] 88 | 89 | if col == 'from_user_name': 90 | if 'from_user_name' in tweet: 91 | val = tweet[col] 92 | elif 'user' in tweet and type(tweet['user']) is dict and 'name' in tweet['user']: 93 | val = tweet['user']['name'] 94 | 95 | 96 | if col == "keyword": 97 | val = keyword 98 | elif col == "city": 99 | val = ', '.join([item['name'] for item in tweet['search_info']['search_areas']]) 100 | elif col == "geo" and tweet['geo']: 101 | val = "%f,%f" % (tweet['geo']['coordinates'][0], tweet['geo']['coordinates'][1]) 102 | elif col in ("created_at", "created_at_local"): 103 | val = str(tweet[col]) 104 | elif col == 'source': 105 | #strip away tags with BeautifulSoup 106 | val = BS(tweet[col]).text 107 | elif col in tweet: 108 | val = tweet[col] 109 | 110 | 111 | if type(val) not in (list, dict) and col not in ("_id", 'search_info', 'entities'): 112 | sheet.cell(row=rowIndx+1, column=colIndx).value = val 113 | 114 | 115 | 116 | book.save(outputPath+"\\"+fileName) 117 | return outputPath+"\\"+fileName 118 | 119 | except Exception, e: 120 | import traceback 121 | print str(e) 122 | print str(traceback.print_exc()) 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Youtube/old/README.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ##Introduction to Facebook Graph API 3 | ######*Project conducted by*: San Diego State University 4 | ######*Report prepared by*: Chih-Yuan Chen 5 | #### Abstract 6 | This technical document will introduce the **Facebook Graph API** and demonstrate how to use the ***Graph API Explorer***, the easiest tool for testing the API. Facebook provides the Graph API for retrieving data in and out of its social graph. This document will start from the basic concepts of Graph API and make a brief introduction of its key elements, the three different types of **HTTP requests**, and the user access token. The second part of this document will demonstrate an example about how to use the ***Graph API Explorer*** to get information from San Diego Zoo facebook page. In addition, a summary of the official and third-party SDKs and a simple python code example are provided. 7 | 8 | #### 1. What is Graph API? 9 | *The Graph API is the primary way to get data in and out of Facebook's social graph. It's a low-level HTTP-based API that you can use to query data, post new stories, upload photos and a variety of other tasks that an app might need to do. 10 | … The APIs are composed of nodes (such as a User, a Photo, a Page, a Comment), edges (such as a Page’s Photos, or a Photo’s Comments), and fields (such as the birthday of a User, or the name of a Page). 11 | —from Facebook developers website* 12 | 13 | Currently, the latest version of the Graph API is v2.2. 14 | 15 | There are three different kinds of requests which Graph API provides: 16 | * *HTTP GET*: The most widely used request in the Graph API used to read all the **nodes and edges**. For example if you want to read all your photos you can do the request below: 17 | 18 | ``` 19 | GET graph.facebook.com 20 | /me/photos 21 | ``` 22 | 23 | Some request will need the access token to make the API calls. If you don’t have it you may get the error message like: 24 | ``` 25 | { 26 | "error": { 27 | "message": "An active access token must be used to query information about the current user.", 28 | "type": "OAuthException", 29 | "code": 2500 30 | } 31 | } 32 | ``` 33 | * *HTTP GET*: The POST request is used to create, update, and delete data in the social graph. For example if you want to publish a post on behalf of someone, you can do: 34 | ``` 35 | POST graph.facebook.com 36 | /{user-id}/feed? 37 | message={message}&access_token={access-token} 38 | ``` 39 | * *HTTP DELETE*: Also used to delete data in Facebook social graph. The JavaScript clients are not supported; those clients have to issue a *POST* request to delete an object. 40 | ``` 41 | POST graph.facebook.com 42 | /{comment-id}?method=delete 43 | ``` 44 | #### 2. Graph API Explorer 45 | In this section, the basic interface of Facebook graph API explorer and its main functions will be introduced. 46 | * **a) The Web-based Interface of Graph API Explorer ( https://developers.facebook.com/tools/explorer/ )** 47 | 48 | The easiest tool for using the Graph API is the Graph API Explorer; for using it a registered Facebook account is required. 49 | * **b) Get the Access Token** 50 | 51 | *When someone connects with an app using Facebook Login, the app will be able to obtain an access token which provides temporary, secure access to Facebook APIs. —from Facebook developers website* 52 | 53 | You will automatically get an access token with default data access permissions when you open the Graph API Explorer.By default Facebook only allows you to retrieve the basic information. For testing you can push the "Get Access Token" button and grant the other data access permissions in the pop-up window. 54 | 55 | * **c) Make the Requests** 56 | 57 | The HTTP requests can be submitted by clicking the "Submit" button on the *Graph API Explorer* webpage. You can select different requests (GET, POST, or DELETE) and input the search target (i.e. a node-id) to explore the query data. In this document we will only focus on how to read (GET) the data out of Facebook's social graph. 58 | 59 | * **d) GET a “Zoo”!** 60 | 61 | The HTTP GET request can be use to retrieve the data from **nodes** (such as a User, a Photo, a Page, or a Comment). For example, if you want to know the information about the San Diego Zoo, you need to input the node-id ‘28896772146’ or its name ‘SanDiegoZoo’ into the query field and push the submit button. The result will come up immediately with a JSON string. 62 | 63 | As can be seen, the detail information of the San Diego Zoo will be included in the JSON string as JSON objects, those objects are the **fields** of the ‘SanDiegoZoo’ **node**. You can also use your web browser and type in http://graph.facebook.com/SanDiegoZoo to get the same result. Here the access token is not required because the SanDiegoZoo is a public place in Facebook. 64 | 65 | If the **node** has a location **fields**, you will find the location information such as address, zip code, or geographical coordinates inside the location object if provided. You can append a search string like ‘?fields =location’ after the node-id or name if you don’t want to see other information but the location information. You can also make a query for multiple fields as well. 66 | 67 | * **e) Graph API Search** 68 | 69 | All public objects can be searched in the Facebook social graph. When using the Graph API Search, the App or user access tokens is required for all search Graph API calls. 70 | For example, if you want to search coffee shops over the place objects in the social graph, you can use the GET request like: 71 | ``` 72 | https://graph.facebook.com/ 73 | search?q=coffee&type=place 74 | &access_token={access-token} 75 | ``` 76 | 77 | This search can be narrowed to a specific location and searching radius by adding the **center** (with latitude and longitude) parameter and a optioanl **distance** parameter. The distance is messured in meters. 78 | ``` 79 | https://graph.facebook.com/ 80 | search?q=coffee&type=place 81 | ¢er=37.76,-122.427&distance=1000 82 | &access_token={access-token} 83 | ``` 84 | * **f)** You can also narrow the search by adding the **fields** parameter. For example, if you only want to show the name and the location information, you will need to append a string like ‘fields=name,location’ to the search string and then all other information will be hidden (see figure 10). Note that the subfields are not supported by location which means you can not extract the subfield information (i.e. latitude and longitude) seperately from the location **fields**. 85 | 86 | #### 3. *Facebook SDKs* 87 | Facebook provides official SDKs for iOS, Android, Unity, JavaScript and PHP. There are also many third-party SDKs for other languages such as Python-sdk. A python example may look like: 88 | ``` 89 | import facebook 90 | # initialize the graphAPI object 91 | graph = facebook.GraphAPI(access_token='your_token', version='2.2') 92 | # get the information of San Diego Zoo by input the Node ID 93 | sandiegozoo = graph.get_object(id=28896772146') 94 | # get the checkin number of San Diego Zoo from the output data 95 | print(sandiegozoo['checkins']) 96 | ``` 97 | 98 | #####For more information please go https://developers.facebook.com. 99 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Foursquare/Example/02-Webpage-example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Foursquare API @ HDMA 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 58 | 59 | 60 |
61 |

Foursquare API DEMO - Find Venues Around

62 |
63 |
64 |
65 |

Search Parameters

66 |
67 |
68 | 69 |
70 | 71 |
72 |
73 |
74 | 75 |
76 | 77 |
78 | 79 |
80 | 81 |
82 | 83 |
84 | 85 |
86 |
87 |
88 |
89 | 90 | 91 | 92 | 93 | 94 |
95 |
96 |
97 |
98 |
99 | 100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |

Search Results

108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 |
Venue NameCategoryDistance from Search Centerlatlong
121 |
122 |
123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/README.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ##Introduction to Facebook Graph API 3 | ######*Project conducted by*: San Diego State University 4 | ######*Report prepared by*: Chih-Yuan Chen 5 | #### Abstract 6 | This technical document will introduce the **Facebook Graph API** and demonstrate how to use the ***Graph API Explorer***, the easiest tool for testing the API. Facebook provides the Graph API for retrieving data in and out of its social graph. This document will start from the basic concepts of Graph API and make a brief introduction of its key elements, the three different types of **HTTP requests**, and the user access token. The second part of this document will demonstrate an example about how to use the ***Graph API Explorer*** to get information from San Diego Zoo facebook page. In addition, a summary of the official and third-party SDKs and a simple python code example are provided. 7 | 8 | #### 1. What is Graph API? 9 | *The Graph API is the primary way to get data in and out of Facebook's social graph. It's a low-level HTTP-based API that you can use to query data, post new stories, upload photos and a variety of other tasks that an app might need to do. 10 | … The APIs are composed of nodes (such as a User, a Photo, a Page, a Comment), edges (such as a Page’s Photos, or a Photo’s Comments), and fields (such as the birthday of a User, or the name of a Page). 11 | —from Facebook developers website* 12 | 13 | Currently, the latest version of the Graph API is v2.2. 14 | 15 | There are three different kinds of requests which Graph API provides: 16 | * *HTTP GET*: The most widely used request in the Graph API used to read all the **nodes and edges**. For example if you want to read all your photos you can do the request below: 17 | 18 | ``` 19 | GET graph.facebook.com 20 | /me/photos 21 | ``` 22 | 23 | Some request will need the access token to make the API calls. If you don’t have it you may get the error message like: 24 | ``` 25 | { 26 | "error": { 27 | "message": "An active access token must be used to query information about the current user.", 28 | "type": "OAuthException", 29 | "code": 2500 30 | } 31 | } 32 | ``` 33 | * *HTTP GET*: The POST request is used to create, update, and delete data in the social graph. For example if you want to publish a post on behalf of someone, you can do: 34 | ``` 35 | POST graph.facebook.com 36 | /{user-id}/feed? 37 | message={message}&access_token={access-token} 38 | ``` 39 | * *HTTP DELETE*: Also used to delete data in Facebook social graph. The JavaScript clients are not supported; those clients have to issue a *POST* request to delete an object. 40 | ``` 41 | POST graph.facebook.com 42 | /{comment-id}?method=delete 43 | ``` 44 | #### 2. Graph API Explorer 45 | In this section, the basic interface of Facebook graph API explorer and its main functions will be introduced. 46 | * **a) The Web-based Interface of Graph API Explorer ( https://developers.facebook.com/tools/explorer/ )** 47 | 48 | The easiest tool for using the Graph API is the Graph API Explorer; for using it a registered Facebook account is required. 49 | * **b) Get the Access Token** 50 | 51 | *When someone connects with an app using Facebook Login, the app will be able to obtain an access token which provides temporary, secure access to Facebook APIs. —from Facebook developers website* 52 | 53 | You will automatically get an access token with default data access permissions when you open the Graph API Explorer.By default Facebook only allows you to retrieve the basic information. For testing you can push the "Get Access Token" button and grant the other data access permissions in the pop-up window. 54 | 55 | * **c) Make the Requests** 56 | 57 | The HTTP requests can be submitted by clicking the "Submit" button on the *Graph API Explorer* webpage. You can select different requests (GET, POST, or DELETE) and input the search target (i.e. a node-id) to explore the query data. In this document we will only focus on how to read (GET) the data out of Facebook's social graph. 58 | 59 | * **d) GET a “Zoo”!** 60 | 61 | The HTTP GET request can be use to retrieve the data from **nodes** (such as a User, a Photo, a Page, or a Comment). For example, if you want to know the information about the San Diego Zoo, you need to input the node-id ‘28896772146’ or its name ‘SanDiegoZoo’ into the query field and push the submit button. The result will come up immediately with a JSON string. 62 | 63 | As can be seen, the detail information of the San Diego Zoo will be included in the JSON string as JSON objects, those objects are the **fields** of the ‘SanDiegoZoo’ **node**. You can also use your web browser and type in http://graph.facebook.com/SanDiegoZoo to get the same result. Here the access token is not required because the SanDiegoZoo is a public place in Facebook. 64 | 65 | If the **node** has a location **fields**, you will find the location information such as address, zip code, or geographical coordinates inside the location object if provided. You can append a search string like ‘?fields =location’ after the node-id or name if you don’t want to see other information but the location information. You can also make a query for multiple fields as well. 66 | 67 | * **e) Graph API Search** 68 | 69 | All public objects can be searched in the Facebook social graph. When using the Graph API Search, the App or user access tokens is required for all search Graph API calls. 70 | For example, if you want to search coffee shops over the place objects in the social graph, you can use the GET request like: 71 | ``` 72 | https://graph.facebook.com/ 73 | search?q=coffee&type=place 74 | &access_token={access-token} 75 | ``` 76 | 77 | This search can be narrowed to a specific location and searching radius by adding the **center** (with latitude and longitude) parameter and a optioanl **distance** parameter. The distance is messured in meters. 78 | ``` 79 | https://graph.facebook.com/ 80 | search?q=coffee&type=place 81 | ¢er=37.76,-122.427&distance=1000 82 | &access_token={access-token} 83 | ``` 84 | * **f)** You can also narrow the search by adding the **fields** parameter. For example, if you only want to show the name and the location information, you will need to append a string like ‘fields=name,location’ to the search string and then all other information will be hidden (see figure 10). Note that the subfields are not supported by location which means you can not extract the subfield information (i.e. latitude and longitude) seperately from the location **fields**. 85 | 86 | #### 3. *Facebook SDKs* 87 | Facebook provides official SDKs for iOS, Android, Unity, JavaScript and PHP. There are also many third-party SDKs for other languages such as Python-sdk. A python example may look like: 88 | ``` 89 | import facebook 90 | # initialize the graphAPI object 91 | graph = facebook.GraphAPI(access_token='your_token', version='2.2') 92 | # get the information of San Diego Zoo by input the Node ID 93 | sandiegozoo = graph.get_object(id=28896772146') 94 | # get the checkin number of San Diego Zoo from the output data 95 | print(sandiegozoo['checkins']) 96 | ``` 97 | 98 | #####For more information please go https://developers.facebook.com. 99 | #####Demo Site: http://vision.sdsu.edu/ychuang/Flickr_InstagramAPI/demoFB.html 100 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/old/README.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ##Introduction to Facebook Graph API 3 | ######*Project conducted by*: San Diego State University 4 | ######*Report prepared by*: Chih-Yuan Chen 5 | #### Abstract 6 | This technical document will introduce the **Facebook Graph API** and demonstrate how to use the ***Graph API Explorer***, the easiest tool for testing the API. Facebook provides the Graph API for retrieving data in and out of its social graph. This document will start from the basic concepts of Graph API and make a brief introduction of its key elements, the three different types of **HTTP requests**, and the user access token. The second part of this document will demonstrate an example about how to use the ***Graph API Explorer*** to get information from San Diego Zoo facebook page. In addition, a summary of the official and third-party SDKs and a simple python code example are provided. 7 | 8 | #### 1. What is Graph API? 9 | *The Graph API is the primary way to get data in and out of Facebook's social graph. It's a low-level HTTP-based API that you can use to query data, post new stories, upload photos and a variety of other tasks that an app might need to do. 10 | … The APIs are composed of nodes (such as a User, a Photo, a Page, a Comment), edges (such as a Page’s Photos, or a Photo’s Comments), and fields (such as the birthday of a User, or the name of a Page). 11 | —from Facebook developers website* 12 | 13 | Currently, the latest version of the Graph API is v2.2. 14 | 15 | There are three different kinds of requests which Graph API provides: 16 | * *HTTP GET*: The most widely used request in the Graph API used to read all the **nodes and edges**. For example if you want to read all your photos you can do the request below: 17 | 18 | ``` 19 | GET graph.facebook.com 20 | /me/photos 21 | ``` 22 | 23 | Some request will need the access token to make the API calls. If you don’t have it you may get the error message like: 24 | ``` 25 | { 26 | "error": { 27 | "message": "An active access token must be used to query information about the current user.", 28 | "type": "OAuthException", 29 | "code": 2500 30 | } 31 | } 32 | ``` 33 | * *HTTP GET*: The POST request is used to create, update, and delete data in the social graph. For example if you want to publish a post on behalf of someone, you can do: 34 | ``` 35 | POST graph.facebook.com 36 | /{user-id}/feed? 37 | message={message}&access_token={access-token} 38 | ``` 39 | * *HTTP DELETE*: Also used to delete data in Facebook social graph. The JavaScript clients are not supported; those clients have to issue a *POST* request to delete an object. 40 | ``` 41 | POST graph.facebook.com 42 | /{comment-id}?method=delete 43 | ``` 44 | #### 2. Graph API Explorer 45 | In this section, the basic interface of Facebook graph API explorer and its main functions will be introduced. 46 | * **a) The Web-based Interface of Graph API Explorer ( https://developers.facebook.com/tools/explorer/ )** 47 | 48 | The easiest tool for using the Graph API is the Graph API Explorer; for using it a registered Facebook account is required. 49 | * **b) Get the Access Token** 50 | 51 | *When someone connects with an app using Facebook Login, the app will be able to obtain an access token which provides temporary, secure access to Facebook APIs. —from Facebook developers website* 52 | 53 | You will automatically get an access token with default data access permissions when you open the Graph API Explorer.By default Facebook only allows you to retrieve the basic information. For testing you can push the "Get Access Token" button and grant the other data access permissions in the pop-up window. 54 | 55 | * **c) Make the Requests** 56 | 57 | The HTTP requests can be submitted by clicking the "Submit" button on the *Graph API Explorer* webpage. You can select different requests (GET, POST, or DELETE) and input the search target (i.e. a node-id) to explore the query data. In this document we will only focus on how to read (GET) the data out of Facebook's social graph. 58 | 59 | * **d) GET a “Zoo”!** 60 | 61 | The HTTP GET request can be use to retrieve the data from **nodes** (such as a User, a Photo, a Page, or a Comment). For example, if you want to know the information about the San Diego Zoo, you need to input the node-id ‘28896772146’ or its name ‘SanDiegoZoo’ into the query field and push the submit button. The result will come up immediately with a JSON string. 62 | 63 | As can be seen, the detail information of the San Diego Zoo will be included in the JSON string as JSON objects, those objects are the **fields** of the ‘SanDiegoZoo’ **node**. You can also use your web browser and type in http://graph.facebook.com/SanDiegoZoo to get the same result. Here the access token is not required because the SanDiegoZoo is a public place in Facebook. 64 | 65 | If the **node** has a location **fields**, you will find the location information such as address, zip code, or geographical coordinates inside the location object if provided. You can append a search string like ‘?fields =location’ after the node-id or name if you don’t want to see other information but the location information. You can also make a query for multiple fields as well. 66 | 67 | * **e) Graph API Search** 68 | 69 | All public objects can be searched in the Facebook social graph. When using the Graph API Search, the App or user access tokens is required for all search Graph API calls. 70 | For example, if you want to search coffee shops over the place objects in the social graph, you can use the GET request like: 71 | ``` 72 | https://graph.facebook.com/ 73 | search?q=coffee&type=place 74 | &access_token={access-token} 75 | ``` 76 | 77 | This search can be narrowed to a specific location and searching radius by adding the **center** (with latitude and longitude) parameter and a optioanl **distance** parameter. The distance is messured in meters. 78 | ``` 79 | https://graph.facebook.com/ 80 | search?q=coffee&type=place 81 | ¢er=37.76,-122.427&distance=1000 82 | &access_token={access-token} 83 | ``` 84 | * **f)** You can also narrow the search by adding the **fields** parameter. For example, if you only want to show the name and the location information, you will need to append a string like ‘fields=name,location’ to the search string and then all other information will be hidden (see figure 10). Note that the subfields are not supported by location which means you can not extract the subfield information (i.e. latitude and longitude) seperately from the location **fields**. 85 | 86 | #### 3. *Facebook SDKs* 87 | Facebook provides official SDKs for iOS, Android, Unity, JavaScript and PHP. There are also many third-party SDKs for other languages such as Python-sdk. A python example may look like: 88 | ``` 89 | import facebook 90 | # initialize the graphAPI object 91 | graph = facebook.GraphAPI(access_token='your_token', version='2.2') 92 | # get the information of San Diego Zoo by input the Node ID 93 | sandiegozoo = graph.get_object(id=28896772146') 94 | # get the checkin number of San Diego Zoo from the output data 95 | print(sandiegozoo['checkins']) 96 | ``` 97 | 98 | #####For more information please go https://developers.facebook.com. 99 | #####Demo Site: http://vision.sdsu.edu/ychuang/Flickr_InstagramAPI/demoFB.html 100 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Facebook/README.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ##Introduction to Facebook Graph API 3 | ######*Project conducted by*: San Diego State University 4 | ######*Report prepared by*: Chih-Yuan Chen 5 | #### Abstract 6 | This technical document will introduce the **Facebook Graph API** and demonstrate how to use the ***Graph API Explorer***, the easiest tool for testing the API. Facebook provides the Graph API for retrieving data in and out of its social graph. This document will start from the basic concepts of Graph API and make a brief introduction of its key elements, the three different types of **HTTP requests**, and the user access token. The second part of this document will demonstrate an example about how to use the ***Graph API Explorer*** to get information from San Diego Zoo facebook page. In addition, a summary of the official and third-party SDKs and a simple python code example are provided. 7 | 8 | #### 1. What is Graph API? 9 | *The Graph API is the primary way to get data in and out of Facebook's social graph. It's a low-level HTTP-based API that you can use to query data, post new stories, upload photos and a variety of other tasks that an app might need to do. 10 | … The APIs are composed of nodes (such as a User, a Photo, a Page, a Comment), edges (such as a Page’s Photos, or a Photo’s Comments), and fields (such as the birthday of a User, or the name of a Page). 11 | —from Facebook developers website* 12 | 13 | Currently, the latest version of the Graph API is v2.2. 14 | 15 | There are three different kinds of requests which Graph API provides: 16 | * *HTTP GET*: The most widely used request in the Graph API used to read all the **nodes and edges**. For example if you want to read all your photos you can do the request below: 17 | 18 | ``` 19 | GET graph.facebook.com 20 | /me/photos 21 | ``` 22 | 23 | Some request will need the access token to make the API calls. If you don’t have it you may get the error message like: 24 | ``` 25 | { 26 | "error": { 27 | "message": "An active access token must be used to query information about the current user.", 28 | "type": "OAuthException", 29 | "code": 2500 30 | } 31 | } 32 | ``` 33 | * *HTTP GET*: The POST request is used to create, update, and delete data in the social graph. For example if you want to publish a post on behalf of someone, you can do: 34 | ``` 35 | POST graph.facebook.com 36 | /{user-id}/feed? 37 | message={message}&access_token={access-token} 38 | ``` 39 | * *HTTP DELETE*: Also used to delete data in Facebook social graph. The JavaScript clients are not supported; those clients have to issue a *POST* request to delete an object. 40 | ``` 41 | POST graph.facebook.com 42 | /{comment-id}?method=delete 43 | ``` 44 | #### 2. Graph API Explorer 45 | In this section, the basic interface of Facebook graph API explorer and its main functions will be introduced. 46 | * **a) The Web-based Interface of Graph API Explorer ( https://developers.facebook.com/tools/explorer/ )** 47 | 48 | The easiest tool for using the Graph API is the Graph API Explorer; for using it a registered Facebook account is required. 49 | * **b) Get the Access Token** 50 | 51 | *When someone connects with an app using Facebook Login, the app will be able to obtain an access token which provides temporary, secure access to Facebook APIs. —from Facebook developers website* 52 | 53 | You will automatically get an access token with default data access permissions when you open the Graph API Explorer.By default Facebook only allows you to retrieve the basic information. For testing you can push the "Get Access Token" button and grant the other data access permissions in the pop-up window. 54 | 55 | * **c) Make the Requests** 56 | 57 | The HTTP requests can be submitted by clicking the "Submit" button on the *Graph API Explorer* webpage. You can select different requests (GET, POST, or DELETE) and input the search target (i.e. a node-id) to explore the query data. In this document we will only focus on how to read (GET) the data out of Facebook's social graph. 58 | 59 | * **d) GET a “Zoo”!** 60 | 61 | The HTTP GET request can be use to retrieve the data from **nodes** (such as a User, a Photo, a Page, or a Comment). For example, if you want to know the information about the San Diego Zoo, you need to input the node-id ‘28896772146’ or its name ‘SanDiegoZoo’ into the query field and push the submit button. The result will come up immediately with a JSON string. 62 | 63 | As can be seen, the detail information of the San Diego Zoo will be included in the JSON string as JSON objects, those objects are the **fields** of the ‘SanDiegoZoo’ **node**. You can also use your web browser and type in http://graph.facebook.com/SanDiegoZoo to get the same result. Here the access token is not required because the SanDiegoZoo is a public place in Facebook. 64 | 65 | If the **node** has a location **fields**, you will find the location information such as address, zip code, or geographical coordinates inside the location object if provided. You can append a search string like ‘?fields =location’ after the node-id or name if you don’t want to see other information but the location information. You can also make a query for multiple fields as well. 66 | 67 | * **e) Graph API Search** 68 | 69 | All public objects can be searched in the Facebook social graph. When using the Graph API Search, the App or user access tokens is required for all search Graph API calls. 70 | For example, if you want to search coffee shops over the place objects in the social graph, you can use the GET request like: 71 | ``` 72 | https://graph.facebook.com/ 73 | search?q=coffee&type=place 74 | &access_token={access-token} 75 | ``` 76 | 77 | This search can be narrowed to a specific location and searching radius by adding the **center** (with latitude and longitude) parameter and a optioanl **distance** parameter. The distance is messured in meters. 78 | ``` 79 | https://graph.facebook.com/ 80 | search?q=coffee&type=place 81 | ¢er=37.76,-122.427&distance=1000 82 | &access_token={access-token} 83 | ``` 84 | * **f)** You can also narrow the search by adding the **fields** parameter. For example, if you only want to show the name and the location information, you will need to append a string like ‘fields=name,location’ to the search string and then all other information will be hidden (see figure 10). Note that the subfields are not supported by location which means you can not extract the subfield information (i.e. latitude and longitude) seperately from the location **fields**. 85 | 86 | #### 3. *Facebook SDKs* 87 | Facebook provides official SDKs for iOS, Android, Unity, JavaScript and PHP. There are also many third-party SDKs for other languages such as Python-sdk. A python example may look like: 88 | ``` 89 | import facebook 90 | # initialize the graphAPI object 91 | graph = facebook.GraphAPI(access_token='your_token', version='2.2') 92 | # get the information of San Diego Zoo by input the Node ID 93 | sandiegozoo = graph.get_object(id=28896772146') 94 | # get the checkin number of San Diego Zoo from the output data 95 | print(sandiegozoo['checkins']) 96 | ``` 97 | 98 | #####For more information please go https://developers.facebook.com. 99 | #####Demo Site: http://vision.sdsu.edu/ychuang/Flickr_InstagramAPI/demoFB.html 100 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Facebook/old/README.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ##Introduction to Facebook Graph API 3 | ######*Project conducted by*: San Diego State University 4 | ######*Report prepared by*: Chih-Yuan Chen 5 | #### Abstract 6 | This technical document will introduce the **Facebook Graph API** and demonstrate how to use the ***Graph API Explorer***, the easiest tool for testing the API. Facebook provides the Graph API for retrieving data in and out of its social graph. This document will start from the basic concepts of Graph API and make a brief introduction of its key elements, the three different types of **HTTP requests**, and the user access token. The second part of this document will demonstrate an example about how to use the ***Graph API Explorer*** to get information from San Diego Zoo facebook page. In addition, a summary of the official and third-party SDKs and a simple python code example are provided. 7 | 8 | #### 1. What is Graph API? 9 | *The Graph API is the primary way to get data in and out of Facebook's social graph. It's a low-level HTTP-based API that you can use to query data, post new stories, upload photos and a variety of other tasks that an app might need to do. 10 | … The APIs are composed of nodes (such as a User, a Photo, a Page, a Comment), edges (such as a Page’s Photos, or a Photo’s Comments), and fields (such as the birthday of a User, or the name of a Page). 11 | —from Facebook developers website* 12 | 13 | Currently, the latest version of the Graph API is v2.2. 14 | 15 | There are three different kinds of requests which Graph API provides: 16 | * *HTTP GET*: The most widely used request in the Graph API used to read all the **nodes and edges**. For example if you want to read all your photos you can do the request below: 17 | 18 | ``` 19 | GET graph.facebook.com 20 | /me/photos 21 | ``` 22 | 23 | Some request will need the access token to make the API calls. If you don’t have it you may get the error message like: 24 | ``` 25 | { 26 | "error": { 27 | "message": "An active access token must be used to query information about the current user.", 28 | "type": "OAuthException", 29 | "code": 2500 30 | } 31 | } 32 | ``` 33 | * *HTTP GET*: The POST request is used to create, update, and delete data in the social graph. For example if you want to publish a post on behalf of someone, you can do: 34 | ``` 35 | POST graph.facebook.com 36 | /{user-id}/feed? 37 | message={message}&access_token={access-token} 38 | ``` 39 | * *HTTP DELETE*: Also used to delete data in Facebook social graph. The JavaScript clients are not supported; those clients have to issue a *POST* request to delete an object. 40 | ``` 41 | POST graph.facebook.com 42 | /{comment-id}?method=delete 43 | ``` 44 | #### 2. Graph API Explorer 45 | In this section, the basic interface of Facebook graph API explorer and its main functions will be introduced. 46 | * **a) The Web-based Interface of Graph API Explorer ( https://developers.facebook.com/tools/explorer/ )** 47 | 48 | The easiest tool for using the Graph API is the Graph API Explorer; for using it a registered Facebook account is required. 49 | * **b) Get the Access Token** 50 | 51 | *When someone connects with an app using Facebook Login, the app will be able to obtain an access token which provides temporary, secure access to Facebook APIs. —from Facebook developers website* 52 | 53 | You will automatically get an access token with default data access permissions when you open the Graph API Explorer.By default Facebook only allows you to retrieve the basic information. For testing you can push the "Get Access Token" button and grant the other data access permissions in the pop-up window. 54 | 55 | * **c) Make the Requests** 56 | 57 | The HTTP requests can be submitted by clicking the "Submit" button on the *Graph API Explorer* webpage. You can select different requests (GET, POST, or DELETE) and input the search target (i.e. a node-id) to explore the query data. In this document we will only focus on how to read (GET) the data out of Facebook's social graph. 58 | 59 | * **d) GET a “Zoo”!** 60 | 61 | The HTTP GET request can be use to retrieve the data from **nodes** (such as a User, a Photo, a Page, or a Comment). For example, if you want to know the information about the San Diego Zoo, you need to input the node-id ‘28896772146’ or its name ‘SanDiegoZoo’ into the query field and push the submit button. The result will come up immediately with a JSON string. 62 | 63 | As can be seen, the detail information of the San Diego Zoo will be included in the JSON string as JSON objects, those objects are the **fields** of the ‘SanDiegoZoo’ **node**. You can also use your web browser and type in http://graph.facebook.com/SanDiegoZoo to get the same result. Here the access token is not required because the SanDiegoZoo is a public place in Facebook. 64 | 65 | If the **node** has a location **fields**, you will find the location information such as address, zip code, or geographical coordinates inside the location object if provided. You can append a search string like ‘?fields =location’ after the node-id or name if you don’t want to see other information but the location information. You can also make a query for multiple fields as well. 66 | 67 | * **e) Graph API Search** 68 | 69 | All public objects can be searched in the Facebook social graph. When using the Graph API Search, the App or user access tokens is required for all search Graph API calls. 70 | For example, if you want to search coffee shops over the place objects in the social graph, you can use the GET request like: 71 | ``` 72 | https://graph.facebook.com/ 73 | search?q=coffee&type=place 74 | &access_token={access-token} 75 | ``` 76 | 77 | This search can be narrowed to a specific location and searching radius by adding the **center** (with latitude and longitude) parameter and a optioanl **distance** parameter. The distance is messured in meters. 78 | ``` 79 | https://graph.facebook.com/ 80 | search?q=coffee&type=place 81 | ¢er=37.76,-122.427&distance=1000 82 | &access_token={access-token} 83 | ``` 84 | * **f)** You can also narrow the search by adding the **fields** parameter. For example, if you only want to show the name and the location information, you will need to append a string like ‘fields=name,location’ to the search string and then all other information will be hidden (see figure 10). Note that the subfields are not supported by location which means you can not extract the subfield information (i.e. latitude and longitude) seperately from the location **fields**. 85 | 86 | #### 3. *Facebook SDKs* 87 | Facebook provides official SDKs for iOS, Android, Unity, JavaScript and PHP. There are also many third-party SDKs for other languages such as Python-sdk. A python example may look like: 88 | ``` 89 | import facebook 90 | # initialize the graphAPI object 91 | graph = facebook.GraphAPI(access_token='your_token', version='2.2') 92 | # get the information of San Diego Zoo by input the Node ID 93 | sandiegozoo = graph.get_object(id=28896772146') 94 | # get the checkin number of San Diego Zoo from the output data 95 | print(sandiegozoo['checkins']) 96 | ``` 97 | 98 | #####For more information please go https://developers.facebook.com. 99 | #####Demo Site: http://vision.sdsu.edu/ychuang/Flickr_InstagramAPI/demoFB.html 100 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/underConstruction/IntegrationAPI/pythonAPI/GeoMongo/GeoMongo.py: -------------------------------------------------------------------------------- 1 | from pymongo import MongoClient 2 | 3 | class GeoMongoClient: 4 | MULTIGEOMETRY = ("MULTILINESTRING", "MULTIPOLYGON") 5 | 6 | def __init__(self, dbName, collectionName, createNew=True): 7 | try: 8 | self._connection = MongoClient() 9 | except Exception, e: 10 | raise e 11 | 12 | if dbName not in self._connection.database_names(): 13 | raise Exception("Error: Database not found: %s." % dbName) 14 | 15 | self._db = self._connection[dbName] 16 | 17 | if not createNew and collectionName not in self._db.collection_names(): 18 | raise Exception("Error: Collection not found: %s." % collectionName) 19 | 20 | self._collection = self._db[collectionName] 21 | 22 | #make sure spatial index is created 23 | self._collection.ensure_index([("geometry", "2dsphere")]) 24 | 25 | 26 | def _combineMultiGeometry(self, docs): 27 | ''' 28 | Private method that combines multigeometry by looking at the "groupId" 29 | property. Since MongoDB does not recognize the MultiPolygon and MultiLineString 30 | GeoJSON types, these must be split up when inserted and re-combined when 31 | queried. 32 | ''' 33 | 34 | results = [] 35 | doneGroups = [] 36 | 37 | for doc in docs: 38 | if 'groupId' in doc: 39 | if doc['groupId'] not in doneGroups: 40 | groupResults = self._collection.find( { 'groupId': doc['groupId'] } ) 41 | 42 | group = { 'type': 'Feature', 'properties': doc['properties'] } 43 | group['geometry'] = { 'type': 'MultiPolygon' if doc['geometry']['type'].upper() == 'POLYGON' else 'MultiLineString' } 44 | 45 | group['geometry']['coordinates'] = [ g['geometry']['coordinates'] for g in groupResults ] 46 | 47 | doneGroups.append(doc['groupId']) 48 | results.append(group) 49 | else: 50 | results.append(doc) 51 | 52 | return results 53 | 54 | 55 | def withinPointBuffer(self, center, radiusMiles): 56 | ''' 57 | Returns all features that are within the region defined by the 58 | center point ("center") and the radius ("radiusMiles"). 59 | ''' 60 | #convert miles to meters 61 | radiusMeters = radiusMiles * 1609.34 62 | 63 | 64 | query = { 'geometry': { '$near' : { '$geometry' : { 'type': 'Point', 'coordinates': center }, '$maxDistance' : radiusMeters } } } 65 | results = self._collection.find(query, {"_id" : 0}) 66 | results = self._combineMultiGeometry(results) 67 | 68 | return [result for result in results] 69 | 70 | 71 | def withinBoundingBox(self, lowerLeft, upperRight): 72 | ''' 73 | Returns all features within the bounding box defined by the "lowerLeft" and 74 | "upperRight" parameters. The function expects each of these parameters to 75 | be a point that defines the lower left and upper right corners of the bounding box. 76 | ''' 77 | 78 | polygon = [ [ lowerLeft[0], lowerLeft[1] ], [ lowerLeft[0], upperRight[1] ], 79 | [ upperRight[0], upperRight[1] ], [ upperRight[0], lowerLeft[1] ], 80 | [ lowerLeft[0], lowerLeft[1] ] ] 81 | 82 | query = { 'geometry': { '$geoWithin': { '$geometry': { 'type': 'Polygon', 'coordinates': [ polygon ] } } } } 83 | results = self._collection.find(query, {"_id" : 0}) 84 | results = self._combineMultiGeometry(results) 85 | 86 | return [result for result in results] 87 | 88 | 89 | def withinPolygon(self, polygon): 90 | ''' 91 | Returns all features that are within the "polygon" parameter. 92 | ''' 93 | 94 | query = { 'geometry': { '$geoWithin': { '$geometry': { 'type': 'Polygon', 'coordinates': [ polygon ] } } } } 95 | results = self._collection.find(query, {"_id" : 0}) 96 | results = self._combineMultiGeometry(results) 97 | 98 | return [result for result in results] 99 | 100 | 101 | def intersectsPolygon(self, polygon): 102 | ''' 103 | Returns all features that either intersect OR are within the "polygon" parameter. 104 | ''' 105 | 106 | query = { 'geometry': { '$geoIntersects': { '$geometry': { 'type': 'Polygon', 'coordinates': [ polygon ] } } } } 107 | results = self._collection.find(query, {"_id" : 0}) 108 | results = self._combineMultiGeometry(results) 109 | 110 | return [result for result in results] 111 | 112 | 113 | def intersectsLine(self, line): 114 | ''' 115 | Returns all features that intersect with the "line" parameter. 116 | ''' 117 | 118 | query = { 'geometry': { '$geoIntersects': { '$geometry': { 'type': 'LineString', 'coordinates': line } } } } 119 | results = self._collection.find(query, {"_id" : 0}) 120 | results = self._combineMultiGeometry(results) 121 | 122 | return [result for result in results] 123 | 124 | 125 | 126 | 127 | def _convertIfNumeric(self, val): 128 | ''' 129 | Checks whether the passed parameter "val" can be converted to an integer 130 | or float. If so, it returns the converted value. Otherwise, it returns the 131 | original parameter. 132 | ''' 133 | 134 | def isFloat(string): 135 | try: 136 | float(string) 137 | return True 138 | except: 139 | return False 140 | 141 | if hasattr(val, 'isdigit') and val.isdigit(): 142 | return int(val) 143 | elif isFloat(val): 144 | return float(val) 145 | 146 | return val 147 | 148 | 149 | def _explodeMultiGeometry(self, geoJson): 150 | ''' 151 | Private method that explodes multigeometry by before inserting into the database. 152 | Since MongoDB does not recognize the MultiPolygon and MultiLineString 153 | GeoJSON types, these must be split up when inserted and re-combined when 154 | queried. 155 | ''' 156 | if not self._collection: 157 | return [] 158 | 159 | if geoJson['geometry']['type'].upper() not in ('MULTIPOLYGON', 'MULTILINESTRING'): 160 | return geoJson 161 | 162 | #get the next groupId available... 163 | groupId = len(self._collection.find().distinct("groupId")) + 1 164 | 165 | result = [] 166 | 167 | for coords in geoJson['geometry']['coordinates']: 168 | item = {} 169 | item['type'] = geoJson['type'] 170 | item['properties'] = geoJson['properties'] 171 | item['groupId'] = groupId 172 | item['geometry'] = { "type": "Polygon", "coordinates": coords } 173 | 174 | result.append(item) 175 | 176 | return result 177 | 178 | 179 | def saveFeature(self, geoJson): 180 | ''' 181 | Inserts the "geoJson" parameter into the current collection. 182 | ''' 183 | 184 | #convert all strings to their numerical values (if applicable) 185 | for prop in geoJson['properties']: 186 | geoJson['properties'][prop] = self._convertIfNumeric(geoJson['properties'][prop]) 187 | 188 | 189 | #if this feature is a MultiPolygon, explode it into a group of Polygons 190 | if geoJson['geometry']['type'].upper() in ('MULTIPOLYGON', 'MULTILINESTRING'): 191 | multi = self._explodeMultiGeometry(geoJson) 192 | 193 | for item in multi: 194 | self._collection.insert(item) 195 | 196 | else: 197 | self._collection.insert(geoJson) 198 | 199 | def saveFeatures(self, geoJsonList): 200 | ''' 201 | Inserts each element of the "geoJsonList" parameter into the current collection. 202 | ''' 203 | 204 | for geoJson in geoJsonList: 205 | self.saveFeature(geoJson) 206 | 207 | 208 | def find(self, query, removeObjectID=False): 209 | ''' 210 | Performs a query on the current collection. Uses standard MongoDB query syntax. 211 | ''' 212 | 213 | if type(query) is not dict: 214 | raise Exception("Query must be a dictionary (ie, JSON).") 215 | 216 | exclude = {"_id" : 0} if removeObjectID else None 217 | 218 | return [ item for item in self._collection.find(args, fields=exclude) ] 219 | 220 | def update(self, document): 221 | ''' 222 | Updates the current collection with the passed "document" parameter. 223 | Note: An Object ID field must be included in the "document" object, otherwise 224 | a new record will be created in the collection. 225 | ''' 226 | 227 | self._collection.save(document) 228 | 229 | 230 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Twitter/README.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ######*Project conducted by*: San Diego State University 3 | ######*Content prepared by*: Jiue-An (Jay) Yang @ San Diego State University 4 | 5 | --- 6 | 7 | ## Using the Search API (with Python) 8 | 9 | Among many popular social media and social networking services, Twitter is kind enough to provide powerful and relatively friendly API for developers to interact with the Twitter database. In this tutorial, we will go through the steps of setting up and using the Twitter Search API. The Twitter API can be accessed with many computer programming language, in this tutorial we use Python to demonstrate how to use the Twitter Search API and access Twitter data (tweets). 10 | 11 | --- 12 | 13 | #### Prerequisite 14 | 15 | ##### Python version 2.x or 3.x 16 | 17 | Python is a popular computer programming language created by Guido van Rossum. 18 | It's currently ranked # 4 by [the IEEE Spectrum’s 2014 Ranking](http://goo.gl/CSfla6). 19 | 20 | To learn more about Python, check out the official website at (https://www.python.org/doc/ 21 | Python can be downloaded at https://www.python.org/download 22 | 23 | ##### Twitter API Libraries for Python 24 | 25 | There are many existing API libraries (wrappers) for Python and they tend to make it easier to work with the Twitter APIs. 26 | A list of Python wrappers for Twitter APIs can be found at https://dev.twitter.com/docs/twitter-libraries. 27 | Navigate to the Python section and install the one of your own choice. In this tutorial, we select the library called *tweepy*. 28 | 29 | Instructions of installing *tweepy* and its documentation can be found at https://github.com/tweepy/tweepy 30 | 31 | --- 32 | 33 | #### Getting Started 34 | 35 | ##### Obtain your API keys. 36 | - Create a Twitter account 37 | - Sign up a Twitter account at https://twitter.com/ 38 | - Log on to Twitter Developer (https://dev.twitter.com/) and sign in with the Twitter account you just created. 39 | - Create your Twitter application and generate your API keys/Tokens. You can follow the tutorial at: [*How to Register a Twitter App in 8 Easy Steps*](http://iag.me/socialmedia/how-to-create-a-twitter-app-in-8-easy-steps/) 40 | 41 | ##### Write Python codes with your API keys to search 42 | 43 | Once you have Python and the tweepy library installed, you are ready to search for the tweets. 44 | The following codes demonstrates how to (1) setup the API Keys and (2) perform a search at the Twitter database. 45 | 46 | - (1) setup your API keys with tweepy (credit to tweepy for this example at: [**tweepy oauth example**](https://github.com/tweepy/tweepy/blob/master/examples/oauth.py) ) 47 | ```python 48 | import tweepy # the Twitter API wrapper 49 | import json # for processing the JSON return later 50 | 51 | # The consumer keys can be found on your application's Details 52 | # page located at https://dev.twitter.com/apps (under "OAuth settings") 53 | consumer_key="" 54 | consumer_secret="" 55 | 56 | # The access tokens can be found on your applications's Details 57 | # page located at https://dev.twitter.com/apps (under "Your access token") 58 | access_token="" 59 | access_token_secret="" 60 | 61 | # authenticate your key with oauth 62 | auth = tweepy.OAuthHandler(consumer_key, consumer_secret) 63 | auth.secure = True 64 | auth.set_access_token(access_token, access_token_secret) 65 | 66 | # setup the API with your Keys 67 | # also, format the return in JSON 68 | api = tweepy.API(auth, parser=tweepy.parsers.JSONParser()) 69 | ``` 70 | 71 | - (2) Now that your endpoint is authenticated with your API keys, we can test the Search API. Here we use a search for tweets containing the term **"coffee"** around **5 miles radius** from the center of **San Diego State University campus**. For displaying, we will only search for *the latest tweet*. 72 | 73 | ```python 74 | # Note: continue from the previous codes 75 | 76 | # Calling the search method, with several parameter 77 | # q: querying keyword 78 | # geocode: filter the return tweets that are within the spatial restrictions 79 | # count: limits the numbers of return 80 | results = api.search(q="coffee", geocode = "32.774575,-117.072404,5mi", count=1) 81 | 82 | # display the search results 83 | print json.dumps(results, indent =4) 84 | ``` 85 | 86 | - (3) Check out the return tweet! As you can see, the return contains many attributes that can be analyzed, such as *text*, *created_at*, and its *location*. (Note: some returned attributes are not displayed to cut down the size of the page) 87 | 88 | ```json 89 | 90 | { 91 | "search_metadata": { 92 | "count": 1, 93 | "completed_in": 0.059, 94 | "max_id_str": "671242629179314176", 95 | "since_id_str": "0", 96 | "next_results": "?max_id=671171507318423554&q=coffee&geocode=32.774575%2C-117.072404%2C5mi&count=1&include_entities=1", 97 | "refresh_url": "?since_id=671242629179314176&q=coffee&geocode=32.774575%2C-117.072404%2C5mi&include_entities=1", 98 | "since_id": 0, 99 | "query": "coffee", 100 | "max_id": 671242629179314176 101 | }, 102 | "statuses": [ 103 | { 104 | "contributors": null, 105 | "truncated": false, 106 | "text": "RT @thefrenchelf: #ArdeeLovesCoffee Holiday on the go. #coffeeaddict #coffee \n\n#thatsdarling #livefolk #lifecaptured\u2026 https://t.co/HccWgy93\u2026", 107 | "is_quote_status": false, 108 | "in_reply_to_status_id": null, 109 | "id": 671242629179314176, 110 | "favorite_count": 0, 111 | "source": "Jeremy987901912", 112 | "retweeted": false, 113 | "coordinates": null, 114 | "entities": { 115 | "symbols": [], 116 | "user_mentions": [ 117 | { 118 | "id": 2971257370, 119 | "indices": [3,16], 120 | "id_str": "2971257370", 121 | "screen_name": "thefrenchelf", 122 | "name": "a r d e e" 123 | } 124 | ], 125 | "hashtags": [ 126 | { 127 | "indices": [18,35], 128 | "text": "ArdeeLovesCoffee" 129 | }, 130 | { 131 | "indices": [55,68], 132 | "text": "coffeeaddict" 133 | }, 134 | { 135 | "indices": [69,76], 136 | "text": "coffee" 137 | }, 138 | { 139 | "indices": [79,92], 140 | "text": "thatsdarling" 141 | }, 142 | { 143 | "indices": [93,102], 144 | "text": "livefolk" 145 | }, 146 | { 147 | "indices": [103,116], 148 | "text": "lifecaptured" 149 | } 150 | ], 151 | "urls": [ 152 | { 153 | "url": "https://t.co/HccWgy93Dn", 154 | "indices": [118,140], 155 | "expanded_url": "https://instagram.com/p/-ri7SOzgkl/", 156 | "display_url": "instagram.com/p/-ri7SOzgkl/" 157 | } 158 | ] 159 | }, 160 | "in_reply_to_screen_name": null, 161 | "in_reply_to_user_id": null, 162 | "retweet_count": 5, 163 | "id_str": "671242629179314176", 164 | "favorited": false, 165 | "user": { 166 | "follow_request_sent": false, 167 | "has_extended_profile": false, 168 | "profile_use_background_image": true, 169 | "default_profile_image": false, 170 | "id": 3682168996, 171 | "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png", 172 | "verified": false, 173 | "profile_text_color": "333333", 174 | "profile_image_url_https": "https://pbs.twimg.com/profile_images/644371870356107264/zUtpAElb_normal.jpg", 175 | "profile_sidebar_fill_color": "DDEEF6", 176 | "entities": { 177 | "description": { 178 | "urls": [] 179 | } 180 | }, 181 | "followers_count": 182, 182 | "profile_sidebar_border_color": "C0DEED", 183 | "id_str": "3682168996", 184 | "profile_background_color": "C0DEED", 185 | "listed_count": 99, 186 | "is_translation_enabled": false, 187 | "utc_offset": null, 188 | "statuses_count": 1952, 189 | "description": "Health Promoter \u272a Triathlete \u272a Dublin born \u272a Mindful", 190 | "friends_count": 988, 191 | "location": "", 192 | "profile_link_color": "0084B4", 193 | "profile_image_url": "http://pbs.twimg.com/profile_images/644371870356107264/zUtpAElb_normal.jpg", 194 | "following": false, 195 | "geo_enabled": false, 196 | "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png", 197 | "screen_name": "Jeremy98790", 198 | "lang": "en", 199 | "profile_background_tile": false, 200 | "favourites_count": 89, 201 | "name": "Jeremy Raske", 202 | "notifications": false, 203 | "url": null, 204 | "created_at": "Thu Sep 17 04:46:12 +0000 2015", 205 | "contributors_enabled": false, 206 | "time_zone": null, 207 | "protected": false, 208 | "default_profile": true, 209 | "is_translator": false 210 | }, 211 | "geo": null, 212 | "in_reply_to_user_id_str": null, 213 | "possibly_sensitive": false, 214 | "lang": "en", 215 | "created_at": "Mon Nov 30 08:21:28 +0000 2015", 216 | "in_reply_to_status_id_str": null, 217 | "place": null, 218 | "metadata": { 219 | "iso_language_code": "en", 220 | "result_type": "recent" 221 | } 222 | } 223 | ] 224 | } 225 | 226 | ``` 227 | 228 | ##### Concluding Notes 229 | 230 | For more information about the search parameters that can be used in your query, 231 | visit the official Twitter developer website at https://dev.twitter.com/ 232 | 233 | Thank you for checking out our page. -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Youtube/README.md: -------------------------------------------------------------------------------- 1 | ![logo](http://humandynamics.sdsu.edu/images/HDMA_Logo.png) 2 | ######*Project conducted by*: San Diego State University 3 | ######*Content prepared by*: Qingyun Zhang @ San Diego State University 4 | 5 | --- 6 | 7 | ##Working with the Youtube Data API## 8 | 9 | 10 | ###Abstract### 11 | 12 | This report introduces the YouTube Data API, which allows developer to connect to the YouTube database for retrieval of users and videos’ information. This report covers details about how to use the API, describing the API method and the example of retrieving data. There are many methods can be used for searching videos, however, this report will only focus on how to search and obtain information about videos using spatial parameters. The data retrieved from YouTube with the API that is used for visualizing and evaluating the accessibility of videos. 13 | 14 | This report covers the following items: 15 | 16 | - How we start and register to use the API 17 | - How the parameters work 18 | - How the API retrieve the data and give response 19 | 20 | 21 | Working with the YouTube Data API 22 | 23 | ###Introduction### 24 | 25 | YouTube is a video website that provides a personalized video clips or collections for its users. It is owned by Google Inc. The YouTube API is the official application programming interface (API) developed and provided by Google. The YouTube API allows developer to access the YouTube database and retrieve information about users or videos. There are six major actions can be performed with the API: 26 | 27 | 28 | In this report, we will focus on the first function Search for videos in an Area, and demonstrate step by step to obtain the information about videos. To demonstrate the use of YouTube API, we will use Python as the programming language. This report uses the YouTube Data API (v3) [Code Samples](https://developers.google.com/youtube/v3/code_samples) to access the YouTube Data API. Documentation of this can be found at [here](https://github.com/youtube/api-samples/blob/master/python/geolocation_search.py) 29 | Here is the A web app that uses the YouTube Data API v3's [search functionality to find videos tagged with geo-coordinates](https://github.com/youtube/geo-search-tool). 30 | 31 | View the live demo at [here](http://youtube.github.io/geo-search-tool/search.html) 32 | 33 | 1. You need to register a Google Account to access the Google Developers Console, request an API key, and register your application. 34 | 2. Create a project in the Google Developers Console and obtain authorization credentials so your application can submit API requests. 35 | 3. After creating your project, make sure the YouTube Data API is one of the services that your application is registered to use: 36 | a. Go to the Developers Console and select the project that you just registered. 37 | b. Open the API Library in the Google Developers Console. If prompted, select a project or create a new one. In the list of APIs, make sure the status is ON for the YouTube Data API v3. 38 | 4. If your application will use any API methods that require user authorization, read the authentication guide to learn how to implement OAuth 2.0 authorization. 39 | 5. Select a client library to simplify your API implementation. 40 | 6. Familiarize yourself with the core concepts of the JSON (JavaScript Object Notation) data format. JSON is a common, language-independent data format that provides a simple text representation of arbitrary data structures. For more information, see json.org. 41 | (From Google Developers) 42 | 43 | Search for videos in an Area: using the search.list Method 44 | 45 | The code sample below calls the API's search.list method with q, location and locationRadius parameters to retrieve search results matching the provided keyword within the radius centered at a particular location. Using the video ids from the search result, the sample calls the API's videos.list method to retrieve location details of each video. 46 | 47 | There are many parameters can be used during the search query. Figure 2 lists out several important spatial parameters for the video search method. 48 | 49 | ![](http://i.imgur.com/cJ3iJO0.jpg)![](http://i.imgur.com/Rj150qz.jpg) 50 | Figure 2, spatial parameters for the search.list method 51 | 52 | To demonstrate the use of this method, we perform a geolocational *video search* for video within 5,000 meters radius from the center of Storm Hall at San Diego State University. There are 25 results will be shown. The following Python codes will connect to the Youtube API and execute the *video search*. 53 | 54 | #!/usr/bin/python 55 | from apiclient.discovery import build 56 | from apiclient.errors import HttpError 57 | from oauth2client.tools import argparser 58 | # Set DEVELOPER_KEY to the API key value from the APIs & auth > Registered apps 59 | # tab of 60 | # https://cloud.google.com/console 61 | # Please ensure that you have enabled the YouTube Data API for your project. 62 | DEVELOPER_KEY = "REPLACE_ME" 63 | YOUTUBE_API_SERVICE_NAME = "youtube" 64 | YOUTUBE_API_VERSION = "v3" 65 | 66 | def youtube_search(options): 67 | youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION, 68 | developerKey=DEVELOPER_KEY) 69 | 70 | # Call the search.list method to retrieve results matching the specified 71 | # query term. 72 | search_response = youtube.search().list( 73 | q=options.q, 74 | type="video", 75 | location=options.location, 76 | locationRadius=options.location_radius, 77 | part="id,snippet", 78 | maxResults=options.max_results 79 | ).execute() 80 | 81 | search_videos = [] 82 | 83 | # Merge video ids 84 | for search_result in search_response.get("items", []): 85 | search_videos.append(search_result["id"]["videoId"]) 86 | video_ids = ",".join(search_videos) 87 | 88 | # Call the videos.list method to retrieve location details for each video. 89 | video_response = youtube.videos().list( 90 | id=video_ids, 91 | part='snippet, recordingDetails' 92 | ).execute() 93 | 94 | videos = [] 95 | 96 | # Add each result to the list, and then display the list of matching videos. 97 | for video_result in video_response.get("items", []): 98 | videos.append("%s, (%s,%s)" % (video_result["snippet"]["title"], 99 | video_result["recordingDetails"]["location"]["latitude"], 100 | video_result["recordingDetails"]["location"]["longitude"])) 101 | 102 | print "Videos:\n", "\n".join(videos), "\n" 103 | 104 | 105 | if __name__ == "__main__": 106 | argparser.add_argument("--q", help="Search term", default="Storm Hall SDSU") 107 | argparser.add_argument("--location", help="Location", default="32.776750, -117.074019") 108 | argparser.add_argument("--location-radius", help="Location radius", default="5km") 109 | argparser.add_argument("--max-results", help="Max results", default=25) 110 | args = argparser.parse_args() 111 | 112 | try: 113 | youtube_search(args) 114 | except HttpError, e: 115 | print "An HTTP error %d occurred:\n%s" % (e.resp.status, e.content) 116 | Figure 3. The python code of Geolocation search. 117 | 118 | If you have you endpoint setup correctly. You should be able to retrieve a response body like following structure. 119 | 120 | { 121 | "kind": "youtube#searchListResponse", 122 | "etag": etag, 123 | "nextPageToken": string, 124 | "prevPageToken": string, 125 | "pageInfo": { 126 | "totalResults": integer, 127 | "resultsPerPage": integer 128 | }, 129 | "items": [ 130 | { 131 | "kind": "youtube#searchResult", 132 | "etag": etag, 133 | "id": { 134 | "kind": string, 135 | "videoId": string, 136 | "channelId": string, 137 | "playlistId": string 138 | }, 139 | "snippet": { 140 | "publishedAt": datetime, 141 | "channelId": string, 142 | "title": string, 143 | "description": string, 144 | "thumbnails": { 145 | (key): { 146 | "url": string, 147 | "width": unsigned integer, 148 | "height": unsigned integer 149 | } 150 | }, 151 | "channelTitle": string, 152 | "liveBroadcastContent": string 153 | } 154 | ] 155 | } 156 | 157 | 158 | Figure 4. JSON structure of representation. 159 | 160 | \#kind Identifies the API resource's type. 161 | 162 | \#etag The Etag of this resource. 163 | 164 | \#id The id object contains information that can be used to uniquely identify the resource that matches the search request. 165 | 166 | \#id.kind The type of the API resource. 167 | 168 | \#id.videoId If the id.type property's value is youtube#video, then this property will be present and its value will contain the ID that YouTube uses to uniquely identify a video that matches the search query. 169 | 170 | \#id.channelId If the id.type property's value is youtube \#channel, then this property will be present and its value will contain the ID that YouTube uses to uniquely identify a channel that matches the search query. 171 | 172 | \#id.playlistId If the id.type property's value is youtube#playlist, then this property will be present and its value will contain the ID that YouTube uses to uniquely identify a playlist that matches the search query. 173 | 174 | \#snippet The snippet object contains basic details about a search result, such as its title or description. For example, if the search result is a video, then the title will be the video's title and the description will be the video's description. 175 | 176 | \#snippet.publishedAt The creation date and time of the resource that the search result identifies. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. 177 | 178 | \#snippet.channelId The value that YouTube uses to uniquely identify the channel that published the resource that the search result identifies. 179 | 180 | \#snippet.title The title of the search result. 181 | 182 | \#snippet.description A description of the search result. 183 | 184 | \#snippet.thumbnails A map of thumbnail images associated with the search result. For each object in the map, the key is the name of the thumbnail image, and the value is an object that contains other information about the thumbnail. 185 | 186 | \#snippet.thumbnails. (key) 187 | Valid key values are: 188 | 189 | - default – The default thumbnail image for this resource. The default thumbnail for a video – or a resource that refers to a video, such as a playlist item or search result – is 120px wide and 90px tall. The default thumbnail for a channel is 88px wide and 88px tall. 190 | 191 | - medium – A higher resolution version of the thumbnail image. For a video (or a resource that refers to a video), this image is 320px wide and 180px tall. For a channel, this image is 240px wide and 240px tall. 192 | 193 | - high – A high resolution version of the thumbnail image. For a video (or a resource that refers to a video), this image is 480px wide and 360px tall. For a channel, this image is 800px wide and 800px tall. 194 | 195 | \#snippet.thumbnails.(key).url The image's URL. 196 | 197 | \#snippet.thumbnails.(key).width The image's width. 198 | 199 | \#snippet.thumbnails.(key).height The image's height. 200 | 201 | \#snippet.channelTitle The title of the channel that published the resource that the search result identifies. 202 | 203 | \#``snippet.liveBroadcastContent An indication of whether a video or channel resource has live broadcast content. 204 | Valid property values are upcoming, live, and none. 205 | 206 | For a video resource, a value of upcoming indicates that the video is a live broadcast that has not yet started, while a value of live indicates that the video is an active live broadcast. For a channel resource, a value of upcoming indicates that the channel has a scheduled broadcast that has not yet started, while a value of live indicates that the channel has an active live broadcast. 207 | -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-Locu/README.md: -------------------------------------------------------------------------------- 1 | **Abstract** 2 | 3 | This report outlines the Locu API, which allows for retrieval of menu information using spatial parameters. This data has potential to be used for mapping and analyzing accessibility to healthy foods. 4 | 5 | **What is Locu?** 6 | 7 | Locu is a service that allows business to monitor and enhance their Internet visibility. It allows businesses to publish and update information regarding hours, menu items, and specials. 8 | 9 | **What is the Locu API?** 10 | 11 | The Locu API allows registered users to search and access information about businesses and menus. 12 | 13 | **Does the API require a key?** 14 | 15 | Yes, go here: [https://dev.locu.com/login/?next=/dashboard/](https://dev.locu.com/login/?next=/dashboard/) 16 | 17 | **How do you find information for specific geographic areas?** 18 | 19 | The [Venue Search API](https://dev.locu.com/documentation/) allows you to specify a geographic area using different parameters: 20 | 21 | - Latitude, longitude, and radius (circular region) 22 | - Latitude and longitude for top-left and bottom-right (bounding box) 23 | - Administrative area: 24 | - Country (eg, "United States") 25 | - Locality/city name (eg, "San Francisco") 26 | - Region/state/province (eg, "CA") 27 | - Postal code 28 | 29 | **What information is available with respect to menus?** 30 | 31 | The main information available is different menu sections, the price of each item, the name of each item, and a description of each item (though the description is frequently omitted). The information about specific attributes returned by in the JSON are documented [here](https://dev.locu.com/documentation/#menu). The following is an example of a menu for Bronx Pizza in San Diego: 32 | 33 | Pizza by the Slice‏ 34 | 35 | Cheese , 2.00 , [no description] 36 | 37 | All Others , 20.50 , [no description] 38 | 39 | Slice Pies 40 | 41 | [no name] , [no price] , [no description] 42 | 43 | Cheese , [no price] , [no description] 44 | 45 | Pepperoni , [no price] , [no description] 46 | 47 | Porko , [no price] , [no description] 48 | 49 | Mushroom , [no price] , [no description] 50 | 51 | Pepperoni Mushroom , [no price] , [no description] 52 | 53 | Bronx Deluxe , [no price] , [no description] 54 | 55 | Veggie , [no price] , [no description] 56 | 57 | Sausage , [no price] , [no description] 58 | 59 | Primavera , [no price] , [no description] 60 | 61 | Artichoke , [no price] , [no description] 62 | 63 | Tomato Garlic , [no price] , [no description] 64 | 65 | Eggplant , [no price] , [no description] 66 | 67 | Pesto , [no price] , [no description] 68 | 69 | Whitestone , [no price] , [no description] 70 | 71 | Whitestone Spinach , [no price] , [no description] 72 | 73 | Whitestone Mushroom , [no price] , [no description] 74 | 75 | Whitestone Pepperoni , [no price] , [no description] 76 | 77 | Calzone‏ 78 | 79 | [no name] , [no price] , [no description] 80 | 81 | Calzone , 60.50 , [no description] 82 | 83 | 18" Whole Pies 84 | 85 | Cheese Pizza , 130.50 , [no description] 86 | 87 | Specialty Pies‏ 88 | 89 | Whitestone , 15.00 , Mozzarella, ricotta, garlic and parmesan. 90 | 91 | Primavera , 180.50 , Broccoli, spinach, peppers, mushrooms and garlic. 92 | 93 | Bronx Deluxe , 190.50 , Pepperoni, sausage, green peppers, black olives, onions, mushrooms and garlic. 94 | 95 | Porko , 18.00 , Pepperoni, sausage and meatballs. 96 | 97 | **Is there a Python wrapper for the API?** 98 | 99 | Yes, check this out: [https://github.com/Locu-Unofficial/locu-python](https://github.com/Locu-Unofficial/locu-python) 100 | 101 | **How would I query venues in a geographic area with this wrapper?** 102 | 103 | More details are available on the GitHub page, but here is a simple query using a latitude, longitude and radius: 104 | 105 | ![](data:image/*;base64,iVBORw0KGgoAAAANSUhEUgAAAlcAAAB3CAIAAAChavLMAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOwwAADsMBx2+oZAAAGxNJREFUeF7tnb9vI0eWx5uXG45uFwsYF4kTyIRx6TYjJ2dQkZIl9oLDZGRIYQFjJlCowMAAi2YoZRONQSdKhjxvMI7E82WHBWcCSdHZwGGc2fsH8F796q7qruru6h9sivw2FEjN6lfvfV6rXr+qZr3edrsNcIAACIAACIDAURL4p6O0GkaDAAiAAAiAACOAKIj7AARAAARA4HgJIAoer+9hOQiAAAiAQHdR8Nte8FL9vN+FIx7nwx4/hvPHXfRXr4/V1FNP4vnDvtoVo+9NV4Ql+XMHriCQ6hjOy/vEyj+RRYrPh9yYxBqrMd5+LK8iWoIACDRCgN6OMY/lmyCIoofa5zMC9BMfo20U5bZo68OHKAwt1rXV3YHLjSalDVxOQsPjUThZlr64bkPudaZB9r4uLXo5CQKlMsmj/z7dgFbvq52yKg0EDUHgMAg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KhCALlgFWq4BgRAAARA4DAIIAoehh9hBQiAAAiAQBUCiIJVqOEaEAABEACBwyCAKHgYfoQVIAACIAACVQggClahhmtAAARAAAQOgwCi4GH4EVaAAAiAAAhUIfD/1xngCl7AVQIAAAAASUVORK5CYII=) 106 | 107 | **Is there a limit on the number of venues can be retrieved?** 108 | 109 | Yes, each call to the Search API will only return 25 venues. To iterate through all result sets (in groups of 25), you must use the following code: 110 | 111 | ![](data:image/*;base64,iVBORw0KGgoAAAANSUhEUgAAAnMAAAAZCAIAAADVIj9MAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOxAAADsYBpx1smQAABcpJREFUeF7tnDt22zgUhqFZi5JijlZArcCuUrlNJ5dyk+MmpYtUc8gy0001OalcSV06ewU6LiJtINkEgwcB4k1AEh+2fja2QOg+vnuBSwI4mtV1TXCBAAiAAAiAAAicicBfZ5IDMSAAAiAAAiAAAowAKivyAARAAARAAATOSQCV9Zw0IQsEQAAEQAAEUFmRA/0SOFTLGb+W1cHVtL31t/dr0+DSBYTb7eCK0xRWS29w0r7cdy/Kbln1rQTyQeC8BFRl3X6bzSrP3Jfbfl7zIO3VE5ivn+gpuX1ZeD25+lo/recnOlktJ1uzGs8ohBCBE31P+XoHn+3t3eLzyUFIMeSoPvP158Xd1AN8lGf40lsmQGc9df0oyD0pfuz1NvZ/brv9fTGpFMWKgVxtNvwv/Uf202Zdu7Eo93JKkrf0KaoobV3m50YVVV7ua+0D6+WTI9pWK2Fha2TTzi0WYphAcYXtaf0q6BUz1TvttiocJ8f1K8RcWUXplNRhLZGog5Y7ymXbzZy4uBW7TaBwZvjjEopj65UW9LoWQjz5KTNE3FZ+U/Er+snMq5CNoTwM5ps+SBqDOVcnsVw+1CbVOG5eBccLz574SMddEJgUAeJWwZKQezeP92VeuyWXj3A2gNnYZX/ZRMMLFb3Rzq30rq5aFjFR0GR/s6h1DTljTqcC5SyiT/XMOilHWSqKplKmDBbGqPaIHNWH+dFlZ25ajOVXrKwaDz8dlVU9l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gTfxzjptxLAOBEAABEDgogigsl5UuOEsCIAACIBA7wRQWXtHDAUgAAIgAAIXRQCV9aLCDWdBAARAAAR6J4DK2jtiKAABEAABELgoAqisFxVuOAsCIAACINA7AVTW3hFDAQiAAAiAwEURQGW9qHDDWRAAARAAgd4J/AFDQ6+5/Pf0agAAAABJRU5ErkJggg==) 112 | 113 | **How would I access the menu information for a given venue using the wrapper?** 114 | 115 | The following shows how to access the menus for a venue by using the "menus" property an an item in the list. Here the menus for the first item are accessed: 116 | 117 | ![](data:image/*;base64,iVBORw0KGgoAAAANSUhEUgAAAh8AAAAcCAIAAABONEoBAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOwwAADsMBx2+oZAAABKJJREFUeF7tnD1u2zAUgKWexc5k9AD2CZwpk9Gtmz3KKBA0Q8YMBQIU0uhsmVp4ymRv7RSfwMjQ5AS9hMofUaJkSaEcwnWST4vjB/L9fGL0HvmUhGmaBlwQgAAEIAABrwQ+eNWGMghAAAIQgIAkQHZhHUAAAhCAgH8CZBf/TNEIAQhAAAJkF9YABCAAAQj4J0B28c8UjRCAAAQgQHZhDUAAAhCAgH8CZBf/TNEIAQhAAAJkF9YABCAAAQj4J0B28c8UjRCAAAQgQHZhDexP4CkZhfIaJU+FEiMMw9naUr2e7Q7d3zIzIQCBYydQyS7rn2GY2I+KzP+u8mMPG/98ERjGj2l6H/WMvvWsv5yIfy8krlVwauWX8SJNH+OhL7vogQAEjpxAJbuMP6Xpx2X/Ihz9tqrRIOgqr4ta17SjkaphZ+usljXPn6LilaWwnq9ls5muetUsW66+aDV28ZzV08rWyKiqvQ22TWOiXIfb09r9D4LCrlW0a6Fwz9hqi7dprWSodJjWl4KR9v4l3Or4a3/cecrbcbeNbyM9cXweb+/s7Yvb78LxrRM3vxkFAQiUCegys3o9xnEQfB3GL5VX5qvadboSZe1UfwqB/EjTeKiKYHXJUcZ0PkPL80H5RFUkT215/rM0shtCfcBu0jb/hSkTgDBs25V+GE9W0/Z4m/ywY5f0tBZ/3Fr4t/AseaX3K8WtyG6YHdHu+Kbl97rXidtqYhQE3jaBhr5LL4rS9MtkeVE5KOsq383lw3gxVtLpmf7UBfhys5n3s/1Df74JNg950TtdZTN6J4Nna4NedDkwik5vpqv7rI6undht76JVNPk/EKbM8dB4sRos7fNF+YDWnowXMpjWeGtdVXFdaybJ1TY+V/B8cWvW04nns3enw4BjWicd3GYoBCBgCDR29f8mo+/Lybc0jYozdTmpq9wJtcgb1U1GllGcppcGyfP97BIH/60nY73ofrd2sHoI3Y07ztgnXnPOtJ7NB5fZPdlHT52LbXo68FSqNw+PlonBiSMSp2G+4tV53nmdOPnGIAhAoEygLrs8JUkYytRSKfy7yjuwHp8N5qUXjxzmbv+o1pDYgJze5MMT0WmxO0Z+n25NXvWiyfbKsiu6D5NyUq7M3CdesY0IrpJi46IekZ64NerpylPkwEDfF9GDuZ4PrA1q8y3VraTSG2YNg33FK5pJ/2OdOKxqhkDg7RAoF++rH6LdEgx/mQ5CvgvoKK87TsxfGBI9A9WKEOdFWmZaETbVrCujRaZVI3/O2gDF60fDOM60qT5EVYm3k812/8uvQ5m2iG65FJeR65ZJZ1elEVtF1nrxwK3Jn3Yna/soxZQdVxv6LpqSGf3a14m3BYciCLxuAqFw/+2kSiI5LAGxb/wc3LqfJXYdf9hosAYBCPgkwF9T+qT5DnWplzFcDjXl8Zd8X4MLAhB4HwTYu7yP+0yUEIAABA5LgL3LYXm3WKt9P9q13X00UeAIBCAAAUWAvQsLAQIQgAAE/BNg7+KfKRohAAEIQIDswhqAAAQgAAH/BMgu/pmiEQIQgAAEyC6sAQhAAAIQ8E+A7OKfKRohAAEIQOAf+4jSDEkQPMAAAAAASUVORK5CYII=) -------------------------------------------------------------------------------- /2015_or_Older_SocialMediaAPI/API-GooglePlaces/Example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HDMA-FoodEnvrionment 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | 19 | 252 | 253 | 254 | 255 |
256 |

Social Media API DEMO

257 |
258 |
259 |
260 |

Search Parameters

261 |
262 |
263 | 264 |
265 | 271 |
272 |
273 |
274 | 275 |
276 | 277 |
278 |
279 |
280 | 281 |
282 | 283 |
284 | 285 |
286 | 287 |
288 | 289 |
290 | 291 |
292 |
293 |
294 |
295 | 296 | 297 | 298 | 299 | 300 |
301 |
302 |
303 |
304 |
305 | 306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |

Search Results

315 | 316 | 317 | 324 | 325 | 326 | 327 |
328 |
329 |
330 | 331 | 332 | 333 | 334 | --------------------------------------------------------------------------------