Lab 1 - Yelp/Twitter Restaurant Client

Due Fri 8/29, 11:59pm

The goal of the first lab is to familiarize you with utilizing web services. You will write a program that will take as input a city and will report the top restaurants in that city; the yelp ratings for each restaurant; and recent tweets containing the name of the restaurant. For this lab, you will (1) register as a developer for both Yelp and Twitter; (2) read and understand the APIs required for the task; (3) understand how to use OAuth to authorize your requests; and (4) extract and display the relevant information from a JSON response object.

Requirements

  • You are expected to use Java or python for this assignment. Solutions implemented in other languages will only be accepted if you have received an exception, via email, from the professor.
  • Your program will require a configuration file named keys.json. This file will contain the city the user wishes to search and all of the keys and tokens required to make a request using Single-User OAuth. Your program must look for this file in the directory where the program is run (i.e. you may hardcode the file name assuming it is in the current path). The format of the file will be as follows.
{

"city": "las vegas",

"yelpconsumerkey": "XYZ",

"yelpconsumersecret": "ABC",

"yelptoken": "123",

"yelptokensecret": "987",

"twitterapikey": "ASDF",

"twitterapisecret": "QWERTY",

"twittertoken": "POIU",

"twittertokensecret": "LKJH"

}
    • First, use the Yelp Search API to find restaurants in the location specified by the city parameter. This will return a JSON document containing a list of restaurants and their ratings, along with some other information.
    • Next, for each restaurant identified by Yelp, use the Twitter Search API to find tweets about the restaurant. A small hint is to search for the restaurant and city to minimize the number of irrelevant tweets (e.g., "burma superstar san francisco" rather than just "burma superstar").
    • Finally, report your results in the following format. You will report on at least 10 restaurants.
Raku

rating: 4.5

what people are saying:

Raku http://t.co/CyETF5NT8m #Spring_Valley #Las_Vegas fresh #tofu http://t.co/302oyQJIjM

#SakeBombs! @ Raku Japanese Charcoal Grill Las Vegas http://t.co/ILPThHhEDH

#Lp #Crackin ? @ Raku Japanese Charcoal Grill Las Vegas http://t.co/QkUZn5uKqE

Mesa Grill

rating: 4.0

what people are saying:

Bobby Flay's Mesa Grill Restaurant at Caesars Palace Las Vegas - #travel, #USA http://t.co/kc1xeToKIL

Picasso

rating: 4.5

what people are saying:

Las Vegas' most expensive residence, owned by Phil Maloof, is more than double the price of the No. 2 listing. http://t.co/PtGax9z5Rx

RT @MySportsLegion: LeBron and DWade had dinner and went clubbing in Las Vegas last night. (Y!)

I'm at Picasso - @bellagio (Las Vegas, NV) http://t.co/Uh6heO3YHH http://t.co/lhV3SZLyKj

$38 million Las Vegas #penthouse comes with Dali and Picasso paintings http://t.co/4T1G50FLd0 via @MailOnline #lasvegas #vegas #tower

$38 million Las Vegas penthouse comes with Dali and Picasso paintings http://t.co/F30ZVmPgPf #usa

    • Java users: you may use the following external libraries. You may not use any other libraries beyond this.
    • Python users: you may use the following external libraries. You may not use any other libraries beyond this.
    • oauth 2.0
    • requests
    • Your program will be run as follows. Keep in mind that correctly submitting your work is extremely important. Naming issues, classpath issues, or hardcoding of file name issues are very common and may result in a grade of 0.
java RestaurantMashup
or
python RestaurantMashup
    • Your work must be submitted in your github repo <username>-lab1.
    • As you work on the assignment, think about what you like about each API, whether one API is better than the other, and what you don't like about each API. You will only be writing a small amount of code, but part of the assignment is to better understand how to work with web services.