PPOL 5203 Data Science I: Foundations

Collecting Digital Data - API

Tiago Ventura


Learning Goals

In the class today, we will learn how to collect digital data through APIs. We will focus on:

  • Building a solid understanding about APIs
  • Working with three types of APIs:
    • APIs with no credentials and no wrappers
    • APIs with credentials and no wrappers
    • APIs with wrappers.
In [1]:
# setup
import requests
import os
import pandas as pd

APIs 101

The famous acronym API stands for “Application Programming Interface”. An API is an online server allows different applications to interact. Most often for our purposes, an API will facilitate information exchange between data users and the holders of certain data. Many companies build these repositories for various functions, including sharing data, receiving data, joint database management, and providing artificial intelligence functions or machines for public use.

Let's think of an example capable of motivating the creation of an API. Imagine you own Twitter. You would have zillions of hackers every day trying to scrape your data, this would make your website more unstable and insecure. What is a possible solution? You create an API, and you control who accesses the information, when they access it, and what type of information you make available. Another option is to close you API and restrict data access to researchers. But, if you do this, you are likely to pay a reputational cost for not being transparent, and users might leave your platform.

Have you ever watched Matrix? APIs are just like that! In the movies, Neil and others would physically connect their mindes to a super developed server and ask to learn a certain skill - kung-fu, programming, language, etc. This is exactly what an API does. You connect to the website and request data, and receive it in return. It's like sending an email, but doing everything via programming language.

API Use-Cases

There are two main ways in which we academics commonly use APIs.

  1. Access data shared by Companies and NGOs.

  2. Process our data in Algorithms developed by third parties.

Our focus will be on the first. Later, we will see how to use the ChatGPT API for text classification tasks.

APIs Components

An API is just an URL. See the example below:

http://mywebsite.com/endpoint?key&param_1&param_2

Main Components:

  • http://mywebsite/: API root. The domain of your api/
  • endpoint: An endpoint is a server route for retrieving specific data from an API
  • key: credentials that some websites ask for you to create before you can query the api.
  • ?param_1*param_2 parameters. Those are filters that you can input in apis requests.

Requests to APIs

In order to work with APIs, we need tools to access the web. In Python, the most common library for making requests and working with APIs is the requests library. There are two main types of requests:

  • get(): to receive information from the API -- which we will use the most for web data collection

  • post(): to send information to the API -- think about the use of ChatGPT for classification of text.

Example 1: Open Trivia API

Querying an API: Step-by-Step

Let's start querying our first API. We will start with the simple Open Trivia API. This is a very simple API, and serves the purpose of learning all the basic steps of querying APIs. The Open Trivia API gives you ideas for your trivia games!

The Trivia API:

  • Does not require us to create credentials.
  • And does not have a Python wrapper.

When querying an API, our work will often involve the following steps:

  • Step 1: Look at the API documentation and endpoints, and construct a query of interest
  • Step 2: Use requests.get(querystring) to call the API
  • Step 3: Examine the response
  • Step 4: Extract your data and save it.

Step 1: Documentation, Endpoints and Query.

Before we start querying an API, we always need to read through the documentation/reference. The documentation often revel to us:

  • The base url for the API: https://opentdb.com/api.php
  • The different endpoints:
    • This api has only one endpoint
  • The API parameters:
    • amount
    • category
    • And some others we will learn.

Notice one thing here. The Trivia API requires you to gave the amount filter in your call. Not all APIs are like this. Some have a random api endpoint for you to play around

In [2]:
# build query
query = "https://opentdb.com/api.php?amount=1"

Step 2: Use requests.get(querystring) to call the API

To interact with the API, we will use the requests package. The requests package allow us to send a HTTP request to the API. Because we are intereste in retrieving data, we will mostly be working with the .get() method, which requires one argument — the URL we want to make the request to.

When we make a request, the response from the API comes with a response code which tells us whether our request was successful. Response codes are important because they immediately tell us if something went wrong.

To make a ‘GET’ request, we’ll use the requests.get() function, which requires one argument — the URL we want to make the request to. We’ll start by making a request to an API endpoint that doesn’t exist, so we can see what that response code looks like

In [4]:
# Make a get request to get the latest position of the ISS from the OpenNotify API.
response = requests.get(query)
type(response)
Out[4]:
requests.models.Response

Step 3: Examine the response

When we make a request, the response from the API comes with a response code which tells us whether our request was successful. Response codes are important because they immediately tell us if something went wrong. Here is a list of response codes you can get

200 — Everything went okay, and the server returned a result (if any).

301 — The server is redirecting you to a different endpoint. This can happen when a company switches domain names, or when an endpoint's name has changed.

401 — The server thinks you're not authenticated. This happens when you don't send the right credentials to access an API.

400 — The server thinks you made a bad request. This can happen when you don't send the information that the API requires to process your request (among other things).

403 — The resource you're trying to access is forbidden, and you don't have the right permissions to see it.

404 — The server didn't find the resource you tried to access.

In [5]:
# check status code
status_code = response.status_code

# print status code
status_code
Out[5]:
200

Step 4: Extract your data.

With an 200 code, we can access the content of the get request. The return from the API is stored as a content attribute in the response object.

In [6]:
print(response.content)
b'{"response_code":0,"results":[{"type":"multiple","difficulty":"hard","category":"History","question":"Who invented the "Flying Shuttle" in 1738; one of the key developments in the industrialization of weaving?","correct_answer":"John Kay","incorrect_answers":["James Hargreaves","Richard Arkwright","John Deere"]}]}'

Processing JSONs

The deafault data type we receive from APIS are in the JSON format. This format encodes data structures like lists and dictionaries as strings to ensure that machines can read them easily.

For that kind of content, the requests library includes a specific .json() method that you can use to immediately convert the API bytes response into a Python data structure, in general a nested dictionary.

In [7]:
# convert the get output to a dictionary
response_dict = response.json()
print(response_dict)
{'response_code': 0, 'results': [{'type': 'multiple', 'difficulty': 'hard', 'category': 'History', 'question': 'Who invented the "Flying Shuttle" in 1738; one of the key developments in the industrialization of weaving?', 'correct_answer': 'John Kay', 'incorrect_answers': ['James Hargreaves', 'Richard Arkwright', 'John Deere']}]}
In [8]:
# index just like a dict
response_dict["results"][0]["question"]
Out[8]:
'Who invented the "Flying Shuttle" in 1738; one of the key developments in the industrialization of weaving?'
In [9]:
# convert to a dataframe
import pandas as pd

# need to convert to a list for weird python reasons
pd.DataFrame([response_dict["results"][0]])
Out[9]:
type difficulty category question correct_answer incorrect_answers
0 multiple hard History Who invented the "Flying Shuttle" in... John Kay [James Hargreaves, Richard Arkwright, John Deere]

Let's see the full code:

In [10]:
# full code
import requests
import pandas as pd

# build query
query = "https://opentdb.com/api.php?amount=1"

# 
response = requests.get(query)

# check status code
status_code = response.status_code

# move forward with code
if status_code==200:
    # convert the get output to a dictionary
    response_dict = response.json()
    # convert to a dataframe
    res = pd.DataFrame([response_dict["results"][0]])
else:
    print(status_code)
    
# print the activity
res
Out[10]:
type difficulty category question correct_answer incorrect_answers
0 multiple easy Entertainment: Music What was Daft Punk's first studio album? Homework [Discovery, Random Access Memories, Human Afte...

Exploring API Filters

If we look at the documentation, you see the APIs provides filters (query parameters) that allow you to refine your search.

For example, when you send a get request to the Youtube API, you are not interested in the entire Youtube data. You want data associated with certain videos, profiles, for a certain period of time, for example. These filters are often embedded as query parameters in the API call.

To add a query parameter to a given URL, you have to add a question mark (?) before the first query parameter. If you want to have multiple query parameters in your request, then you can split them with an ampersand (&)

We can add filters by:

  • constructing the full API call

  • Using dictionaries

Filter with the full API cal

In [11]:
## get only recreational activities
# build query
query = "https://opentdb.com/api.php"

# add filter
activity = "?amount=10"

# full request
url = query + activity

# Make a get request 
response = requests.get(url)

# see json
response.json()
Out[11]:
{'response_code': 0,
 'results': [{'type': 'boolean',
   'difficulty': 'medium',
   'category': 'Entertainment: Video Games',
   'question': 'The game series "Titanfall" runs on the Unreal Engine.',
   'correct_answer': 'False',
   'incorrect_answers': ['True']},
  {'type': 'multiple',
   'difficulty': 'hard',
   'category': 'Science & Nature',
   'question': 'What is the most potent toxin known?',
   'correct_answer': 'Botulinum toxin',
   'incorrect_answers': ['Ricin', 'Cyanide', 'Asbestos']},
  {'type': 'multiple',
   'difficulty': 'hard',
   'category': 'Entertainment: Video Games',
   'question': '"Banjo-Kazooie" originally started its development as a totally different game for the SNES under which codename?',
   'correct_answer': 'Project Dream',
   'incorrect_answers': ['Project Ukulele', 'Project Land', 'Project BK']},
  {'type': 'multiple',
   'difficulty': 'easy',
   'category': 'Entertainment: Film',
   'question': 'Which James Bond film had the theme song written and performed by English singer-songwriter Adele?',
   'correct_answer': 'Skyfall',
   'incorrect_answers': ['Casino Royale', 'Quantum Solace', 'Spectre']},
  {'type': 'multiple',
   'difficulty': 'medium',
   'category': 'Entertainment: Video Games',
   'question': 'Which of the following created and directed the Katamari Damacy series?',
   'correct_answer': 'Keita Takahashi',
   'incorrect_answers': ['Hideki Kamiya', 'Shu Takumi', 'Shinji Mikami']},
  {'type': 'multiple',
   'difficulty': 'medium',
   'category': 'Entertainment: Video Games',
   'question': 'What numbers did Sayaka Maizono write on the wall in Dangan Ronpa Trigger Happy Havoc?',
   'correct_answer': '11037',
   'incorrect_answers': ['4, 8, 15, 16, 23, 42',
    '55730',
    '3, 9, 11, 12, 15, 17,']},
  {'type': 'multiple',
   'difficulty': 'medium',
   'category': 'Entertainment: Music',
   'question': 'Which Beatle led the way across the zebra crossing on the Abbey Road album cover?',
   'correct_answer': 'John',
   'incorrect_answers': ['Paul', 'George', 'Ringo']},
  {'type': 'multiple',
   'difficulty': 'easy',
   'category': 'Entertainment: Television',
   'question': 'In the original Star Trek TV series, what was Captain James T. Kirk's middle name?',
   'correct_answer': 'Tiberius',
   'incorrect_answers': ['Trevor', 'Travis', 'Tyrone']},
  {'type': 'multiple',
   'difficulty': 'hard',
   'category': 'Entertainment: Video Games',
   'question': 'What Touhou Project character's first ever appearance was as a midboss in the eighth game, Imperishable Night?',
   'correct_answer': 'Tewi Inaba',
   'incorrect_answers': ['Mystia Lorelei', 'Kaguya Houraisan', 'Rumia']},
  {'type': 'multiple',
   'difficulty': 'easy',
   'category': 'Entertainment: Music',
   'question': 'Which brass instrument has the lowest pitch in an orchestra?',
   'correct_answer': 'Tuba',
   'incorrect_answers': ['Trumpet', 'Saxophone', 'Trombone']}]}

Or using dictionaries

In [12]:
## get only recreational activities
# build query
query = "https://opentdb.com/api.php"

# add filter
parameters = {"amount": "10", 
             "category":"9"}

# Make a get request to get 
response = requests.get(query, params=parameters)

# see json
print(response.status_code)
response.json()
200
Out[12]:
{'response_code': 0,
 'results': [{'type': 'boolean',
   'difficulty': 'easy',
   'category': 'General Knowledge',
   'question': 'It is automatically considered entrapment in the United States if the police sell you illegal substances without revealing themselves.',
   'correct_answer': 'False',
   'incorrect_answers': ['True']},
  {'type': 'multiple',
   'difficulty': 'easy',
   'category': 'General Knowledge',
   'question': 'In which cardinal direction does the Sun rise from?',
   'correct_answer': 'East',
   'incorrect_answers': ['West', 'North', 'South']},
  {'type': 'multiple',
   'difficulty': 'hard',
   'category': 'General Knowledge',
   'question': 'The Quadrangularis Reversum is best described as which of the following?',
   'correct_answer': 'A percussion instrument',
   'incorrect_answers': ['A building in Oxford University',
    'A chess move',
    'A geometric theorem']},
  {'type': 'boolean',
   'difficulty': 'easy',
   'category': 'General Knowledge',
   'question': 'The National Animal of Scotland is the Unicorn.',
   'correct_answer': 'True',
   'incorrect_answers': ['False']},
  {'type': 'multiple',
   'difficulty': 'easy',
   'category': 'General Knowledge',
   'question': 'What was the first ever London Underground line to be built?',
   'correct_answer': 'Metropolitan Line',
   'incorrect_answers': ['Circle Line', 'Bakerloo Line', 'Victoria Line']},
  {'type': 'multiple',
   'difficulty': 'hard',
   'category': 'General Knowledge',
   'question': 'The word "astasia" means which of the following?',
   'correct_answer': 'The inability to stand up',
   'incorrect_answers': ['The inability to make decisions',
    'The inability to concentrate on anything',
    'A feverish desire to rip one's clothes off']},
  {'type': 'boolean',
   'difficulty': 'easy',
   'category': 'General Knowledge',
   'question': 'On average, at least 1 person is killed by a drunk driver in the United States every hour.',
   'correct_answer': 'True',
   'incorrect_answers': ['False']},
  {'type': 'multiple',
   'difficulty': 'medium',
   'category': 'General Knowledge',
   'question': 'When was WhatsApp founded?',
   'correct_answer': '2009',
   'incorrect_answers': ['2007', '2012', '2010']},
  {'type': 'multiple',
   'difficulty': 'easy',
   'category': 'General Knowledge',
   'question': 'When someone is inexperienced they are said to be what color?',
   'correct_answer': 'Green',
   'incorrect_answers': ['Red', 'Blue', 'Yellow']},
  {'type': 'multiple',
   'difficulty': 'easy',
   'category': 'General Knowledge',
   'question': 'What is the shape of the toy invented by Hungarian professor Ernő Rubik?',
   'correct_answer': 'Cube',
   'incorrect_answers': ['Sphere', 'Cylinder', 'Pyramid']}]}

See... it is the same url..

In [13]:
response.url
Out[13]:
'https://opentdb.com/api.php?amount=10&category=9'
In [14]:
pd.DataFrame(response.json()["results"])
Out[14]:
type difficulty category question correct_answer incorrect_answers
0 boolean easy General Knowledge It is automatically considered entrapment in t... False [True]
1 multiple easy General Knowledge In which cardinal direction does the Sun rise ... East [West, North, South]
2 multiple hard General Knowledge The Quadrangularis Reversum is best described ... A percussion instrument [A building in Oxford University, A chess move...
3 boolean easy General Knowledge The National Animal of Scotland is the Unicorn. True [False]
4 multiple easy General Knowledge What was the first ever London Underground lin... Metropolitan Line [Circle Line, Bakerloo Line, Victoria Line]
5 multiple hard General Knowledge The word "astasia" means which of th... The inability to stand up [The inability to make decisions, The inabilit...
6 boolean easy General Knowledge On average, at least 1 person is killed by a d... True [False]
7 multiple medium General Knowledge When was WhatsApp founded? 2009 [2007, 2012, 2010]
8 multiple easy General Knowledge When someone is inexperienced they are said to... Green [Red, Blue, Yellow]
9 multiple easy General Knowledge What is the shape of the toy invented by Hunga... Cube [Sphere, Cylinder, Pyramid]

Example 2: Yelp API.

Let's transition now to a more complex, and with interesting data, API. We will work with the Yelp API.

This API:

  • Requires us to get credentials
  • But does not have a wrapper to query the daya (that I know of).

See the documentation for the API here. The API has some interesting endpoints, for example:

  • /businesses/search - Search for businesses by keyword, category, location, price level, etc.
  • /businesses/{id} - Get rich business data, such as name, address, phone number, photos, Yelp rating, price levels and hours of operation.
  • /businesses/{business_id_or_alias}/reviews - Get up to three review excerpts for a business.
  • Among many other endpoints

Authentication with an API

Most often, the provider of an API will require you to authenticate before you can get some data. Authentication usually occures through an access token you can generate directly from the API. Depending on the type of authentication each API have in place, it can be a simple token (string) or multiple different ids (Client ID, Access Token, Client Token..)

Keep in mind that using a token is better than using a username and password for a few reasons:

  • Typically, you'll be accessing an API from a script. If you put your username and password in the script and someone finds it, they can take over your account.

  • Access tokens can have scopes and specific permissions.

To authorize your access, you need to add the token to your API call. Often, you do this by passing the token through an authorization header. We can use Python's requests library to make a dictionary of headers, and then pass it into our request.

Acquiring credentials with Yelp Fusion API

Information about acquiring your credentials to make API call are often displayed in the API documentation.

Here it is Yelp's information

Every API has a bit of a distinct process. In general, APIs require you to create an app to access the API. This is a bit of a weird terminology. The assumption here is that you are creating an app (think about the Botometer at Twitter) that will query the API many times.

For the YELP API, after you create the app, you will get an Client ID and an API KEY

How to save the API keys/token?

API keys are personal information. Keep yours safe, and do not paste into your code.

Don't do this:

api_key = "my_key"

Do this:

  • create a file with your keys and save as .env
  • Add your keys there
  • load them in your environment when running the APIs.
  • And never upload your .env file in a public server (like github)

I will show you in class what a .env file looks like.

Querying the API

We repeat the same steps as before, but adding an authentication step.

  • Step 0: Load your API Keys
  • Step 1: Look at the API documentation and endpoints, and construct a query of interest
  • Step 2: Use requests.get(querystring) to call the API
  • Step 3: Examine the response
  • Step 4: Extract your data and save it.

Step 0: Load your API Keys

In [15]:
# load library to get environmental files
import os
from dotenv import load_dotenv


# load keys from  environment variables
load_dotenv() # .env file in cwd

# Print all environment variables
#for key, value in os.environ.items():
#    print(key, "=", value)

yelp_client = os.environ.get("yelp_client_id") 
yelp_key = os.environ.get("yelp_api_key")

# OR JUST HARD CODE YOUR API KEY HERE. NOT A GREAT PRACTICE!!!
#yelp_key = ""

# save your token in the header of the call
header = {'Authorization': f'Bearer {yelp_key}'}
In [16]:
# see here
header["Authorization"]
Out[16]:
'Bearer syM5u9r4OFOcdp-ApFx8wD6GEDKaG97kUs9xiO9jQStWvZisnQT3_JENEKYXl6aazVMZAypJPh2g6v4IRHT8viNgXQTObKVWVGQWe_qfiZXVMfs1W047aGAHK9wRZXYx'

Step 1: Look at the API documentation and endpoints, and construct a query of interest

We will query the /businesses/search endpoint. Let's check together the documentation here: https://docs.developer.yelp.com/reference/v3_business_search

We will use two parameters:

  • location: This string indicates the geographic area to be used when searching for businesses
  • term: Search term, e.g. "food" or "restaurants".
In [17]:
# endpoint
endpoint = "https://api.yelp.com/v3/businesses/search"

# Add as parameters
params ={"location":" Washington, DC 20057",
        "term":"best noodles restaurant"}

Step 2: Use requests.get(endpoint) to call the API

In [18]:
# Make a get request with header + parameters
response = requests.get(endpoint, 
                        headers=header,
                        params=params)

Step 3: Examine the response

Let's check the response code

In [19]:
# looking for a 200
response.status_code
Out[19]:
200

Step 4: Extract your data and save it.

In [20]:
# What does the response look like?
yelp_json = response.json()

# print
print(yelp_json)
{'businesses': [{'id': 'ZE82dmfQVd3d7V1-xzjK5Q', 'alias': 'yu-noodles-arlington', 'name': 'Yu Noodles', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/SQfbwgz4Wgl__kIl96FUDQ/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/yu-noodles-arlington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 20, 'categories': [{'alias': 'chinese', 'title': 'Chinese'}, {'alias': 'noodles', 'title': 'Noodles'}], 'rating': 4.0, 'coordinates': {'latitude': 38.89511776584536, 'longitude': -77.07472644746304}, 'transactions': ['delivery', 'pickup'], 'location': {'address1': '1515 Wilson Blvd', 'address2': 'Unit 102', 'address3': None, 'city': 'Arlington', 'zip_code': '22209', 'country': 'US', 'state': 'VA', 'display_address': ['1515 Wilson Blvd', 'Unit 102', 'Arlington, VA 22209']}, 'phone': '+17037184928', 'display_phone': '(703) 718-4928', 'distance': 1575.158639233165}, {'id': 'eV_87BqGbpvTqUwjOgQO5g', 'alias': 'reren-washington-3', 'name': 'Reren', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/PxQkgCY0DJG8ymZJgRa1Aw/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/reren-washington-3?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 222, 'categories': [{'alias': 'asianfusion', 'title': 'Asian Fusion'}, {'alias': 'ramen', 'title': 'Ramen'}, {'alias': 'nightlife', 'title': 'Nightlife'}], 'rating': 4.0, 'coordinates': {'latitude': 38.90468, 'longitude': -77.06262}, 'transactions': ['delivery', 'pickup'], 'price': '$$', 'location': {'address1': '1073 Wisconsin Ave NW', 'address2': '2 floor', 'address3': '', 'city': 'Washington, DC', 'zip_code': '20007', 'country': 'US', 'state': 'DC', 'display_address': ['1073 Wisconsin Ave NW', '2 floor', 'Washington, DC 20007']}, 'phone': '+12028044962', 'display_phone': '(202) 804-4962', 'distance': 1231.3769005643042}, {'id': 'hviVXv1CZKWlwbX5JcE2JQ', 'alias': 'rimtang-washington', 'name': 'Rimtang', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/nHt8VuSXNb5D_pv8-vQsdQ/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/rimtang-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 46, 'categories': [{'alias': 'thai', 'title': 'Thai'}], 'rating': 4.4, 'coordinates': {'latitude': 38.9047, 'longitude': -77.06586}, 'transactions': ['delivery', 'pickup'], 'location': {'address1': '1039 33rd St NW', 'address2': '', 'address3': None, 'city': 'Washington, DC', 'zip_code': '20007', 'country': 'US', 'state': 'DC', 'display_address': ['1039 33rd St NW', 'Washington, DC 20007']}, 'phone': '', 'display_phone': '', 'distance': 980.1319873294873}, {'id': 'RiwIUBITUfhn6etk6qVbnQ', 'alias': 'uyghur-eats-washington', 'name': 'Uyghur Eats', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/GbQu1AtPp5XrzNrKMDgMXg/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/uyghur-eats-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 204, 'categories': [{'alias': 'noodles', 'title': 'Noodles'}, {'alias': 'kebab', 'title': 'Kebab'}, {'alias': 'tea', 'title': 'Tea Rooms'}], 'rating': 4.3, 'coordinates': {'latitude': 38.92138, 'longitude': -77.07251}, 'transactions': ['delivery', 'restaurant_reservation', 'pickup'], 'price': '$$', 'location': {'address1': '2412 Wisconsin Ave NW', 'address2': '', 'address3': None, 'city': 'Washington, DC', 'zip_code': '20007', 'country': 'US', 'state': 'DC', 'display_address': ['2412 Wisconsin Ave NW', 'Washington, DC 20007']}, 'phone': '+12023333600', 'display_phone': '(202) 333-3600', 'distance': 1371.8029305552445}, {'id': 'Ek_-kvajIvVJbi3ll4pMww', 'alias': 'pho-75-arlington', 'name': 'Pho 75', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/g-xbssrgCv1z3zCDRTkKPQ/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/pho-75-arlington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 2157, 'categories': [{'alias': 'vietnamese', 'title': 'Vietnamese'}, {'alias': 'noodles', 'title': 'Noodles'}], 'rating': 4.1, 'coordinates': {'latitude': 38.8941969403826, 'longitude': -77.0788539337479}, 'transactions': ['delivery'], 'price': '$$', 'location': {'address1': '1721 Wilson Blvd', 'address2': None, 'address3': '', 'city': 'Arlington', 'zip_code': '22209', 'country': 'US', 'state': 'VA', 'display_address': ['1721 Wilson Blvd', 'Arlington, VA 22209']}, 'phone': '+17035257355', 'display_phone': '(703) 525-7355', 'distance': 1699.7430086974475}, {'id': 'QanUICteMAzlK7jVADa1JA', 'alias': 'oki-shoten-washington', 'name': 'OKI Shoten', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/w4kLjEJHw08_Mm09LJpUtQ/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/oki-shoten-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 309, 'categories': [{'alias': 'ramen', 'title': 'Ramen'}], 'rating': 4.0, 'coordinates': {'latitude': 38.911279798268254, 'longitude': -77.06564635638217}, 'transactions': ['pickup', 'delivery'], 'price': '$$', 'location': {'address1': '1614 Wisconsin Ave NW', 'address2': '', 'address3': None, 'city': 'Washington, DC', 'zip_code': '20007', 'country': 'US', 'state': 'DC', 'display_address': ['1614 Wisconsin Ave NW', 'Washington, DC 20007']}, 'phone': '+12029448660', 'display_phone': '(202) 944-8660', 'distance': 887.4584715879362}, {'id': 'HYu17SsplcpRLDjseFfZ_g', 'alias': 'bangbop-washington', 'name': 'Bangbop', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/FRTOxwMof-95D_G4ukV-ZA/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/bangbop-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 98, 'categories': [{'alias': 'korean', 'title': 'Korean'}, {'alias': 'asianfusion', 'title': 'Asian Fusion'}, {'alias': 'panasian', 'title': 'Pan Asian'}], 'rating': 4.6, 'coordinates': {'latitude': 38.90689510951072, 'longitude': -77.08214588428672}, 'transactions': ['pickup'], 'price': '$$', 'location': {'address1': '4418 MacArthur Blvd NW', 'address2': 'Unit 1B', 'address3': '', 'city': 'Washington, DC', 'zip_code': '20007', 'country': 'US', 'state': 'DC', 'display_address': ['4418 MacArthur Blvd NW', 'Unit 1B', 'Washington, DC 20007']}, 'phone': '+12023500846', 'display_phone': '(202) 350-0846', 'distance': 627.0432447708556}, {'id': 'Lx9N4_5bWxfLTU3f-_8YBw', 'alias': 'dumplings-and-beyond-washington', 'name': 'Dumplings & Beyond', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/zWuV4mC8tRVLbTxLzFrieg/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/dumplings-and-beyond-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 627, 'categories': [{'alias': 'chinese', 'title': 'Chinese'}], 'rating': 4.1, 'coordinates': {'latitude': 38.9211850288095, 'longitude': -77.0723823064345}, 'transactions': ['delivery', 'pickup'], 'price': '$$', 'location': {'address1': '2400 Wisconsin Ave NW', 'address2': 'Fl 2', 'address3': '', 'city': 'Washington, DC', 'zip_code': '20007', 'country': 'US', 'state': 'DC', 'display_address': ['2400 Wisconsin Ave NW', 'Fl 2', 'Washington, DC 20007']}, 'phone': '+12023383815', 'display_phone': '(202) 338-3815', 'distance': 1353.517868694155}, {'id': 'IpXiBHLfL1hRyPEIoljA7A', 'alias': 'ramen-by-uzu-washington-5', 'name': 'Ramen By Uzu', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/qChXwu3qrKv78J6pg98BPw/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/ramen-by-uzu-washington-5?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 13, 'categories': [{'alias': 'ramen', 'title': 'Ramen'}, {'alias': 'comfortfood', 'title': 'Comfort Food'}], 'rating': 5.0, 'coordinates': {'latitude': 38.9038, 'longitude': -77.06351}, 'transactions': ['delivery', 'pickup'], 'location': {'address1': '3210 Grace St NW', 'address2': None, 'address3': '', 'city': 'Washington, DC', 'zip_code': '20007', 'country': 'US', 'state': 'DC', 'display_address': ['3210 Grace St NW', 'Washington, DC 20007']}, 'phone': '', 'display_phone': '', 'distance': 1208.6386840517632}, {'id': 'XKOVFGUCK1e0vZBML4ddxw', 'alias': 'donsak-thai-restaurant-washington', 'name': 'Donsak Thai Restaurant ', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/btbTD5jafxl-eyTstndhSQ/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/donsak-thai-restaurant-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 132, 'categories': [{'alias': 'thai', 'title': 'Thai'}], 'rating': 4.3, 'coordinates': {'latitude': 38.92398, 'longitude': -77.05212}, 'transactions': ['delivery', 'pickup'], 'location': {'address1': '2608 Connecticut Ave NW', 'address2': '', 'address3': None, 'city': 'Washington, DC', 'zip_code': '20008', 'country': 'US', 'state': 'DC', 'display_address': ['2608 Connecticut Ave NW', 'Washington, DC 20008']}, 'phone': '+12025078207', 'display_phone': '(202) 507-8207', 'distance': 2610.575512747587}, {'id': 'HWLdm1oYJ9uN4RK39eW5uQ', 'alias': 'little-tiger-dumplings-arlington', 'name': 'Little Tiger Dumplings', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/1Jy1VbjshSa8EhH0gVvhbQ/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/little-tiger-dumplings-arlington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 5, 'categories': [{'alias': 'chinese', 'title': 'Chinese'}, {'alias': 'bubbletea', 'title': 'Bubble Tea'}, {'alias': 'coffee', 'title': 'Coffee & Tea'}], 'rating': 4.6, 'coordinates': {'latitude': 38.89557, 'longitude': -77.07202}, 'transactions': ['delivery', 'pickup'], 'location': {'address1': '1700 N Moore St', 'address2': 'Fl M2', 'address3': None, 'city': 'Arlington', 'zip_code': '22209', 'country': 'US', 'state': 'VA', 'display_address': ['1700 N Moore St', 'Fl M2', 'Arlington, VA 22209']}, 'phone': '+12409138222', 'display_phone': '(240) 913-8222', 'distance': 1548.7537924472003}, {'id': 'SPWt2Gqb2-alIq78YINs-w', 'alias': 'toryumon-japanese-house-arlington-2', 'name': 'Toryumon Japanese House', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/-0vbjDpegRMxLA2Xxnadxw/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/toryumon-japanese-house-arlington-2?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 271, 'categories': [{'alias': 'sushi', 'title': 'Sushi Bars'}, {'alias': 'ramen', 'title': 'Ramen'}, {'alias': 'asianfusion', 'title': 'Asian Fusion'}], 'rating': 4.3, 'coordinates': {'latitude': 38.89405977663849, 'longitude': -77.07763317257343}, 'transactions': ['delivery', 'restaurant_reservation', 'pickup'], 'price': '$$', 'location': {'address1': '1650 Wilson Blvd', 'address2': 'Ste 100B', 'address3': '', 'city': 'Arlington', 'zip_code': '22209', 'country': 'US', 'state': 'VA', 'display_address': ['1650 Wilson Blvd', 'Ste 100B', 'Arlington, VA 22209']}, 'phone': '+15713571537', 'display_phone': '(571) 357-1537', 'distance': 1700.4810849971807}, {'id': 'DB9hhm2cB9Iu88RQw6aqCQ', 'alias': 'thai-and-time-again-washington-2', 'name': 'Thai And Time Again', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/a45aQvDcN85q1EZhssmv3g/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/thai-and-time-again-washington-2?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 61, 'categories': [{'alias': 'thai', 'title': 'Thai'}, {'alias': 'noodles', 'title': 'Noodles'}, {'alias': 'soup', 'title': 'Soup'}], 'rating': 4.5, 'coordinates': {'latitude': 38.92376109199186, 'longitude': -77.05098199999999}, 'transactions': ['delivery', 'pickup'], 'price': '$$', 'location': {'address1': '2311 Calvert St NW', 'address2': None, 'address3': '', 'city': 'Washington, DC', 'zip_code': '20748', 'country': 'US', 'state': 'DC', 'display_address': ['2311 Calvert St NW', 'Washington, DC 20748']}, 'phone': '+12025061076', 'display_phone': '(202) 506-1076', 'distance': 2668.901780760328}, {'id': 'xmVrPFMaJ5ko3o1wxjnIZg', 'alias': 'han-palace-washington-2', 'name': 'Han Palace', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/Lac5ziSNjXDhJ_ku6dMaCg/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/han-palace-washington-2?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 334, 'categories': [{'alias': 'dimsum', 'title': 'Dim Sum'}, {'alias': 'cantonese', 'title': 'Cantonese'}], 'rating': 3.9, 'coordinates': {'latitude': 38.92497, 'longitude': -77.05199}, 'transactions': ['delivery', 'pickup'], 'price': '$$', 'location': {'address1': '2649 Connecticut Ave NW', 'address2': '', 'address3': None, 'city': 'Washington, DC', 'zip_code': '20008', 'country': 'US', 'state': 'DC', 'display_address': ['2649 Connecticut Ave NW', 'Washington, DC 20008']}, 'phone': '+12029690018', 'display_phone': '(202) 969-0018', 'distance': 2687.3966671698704}, {'id': 'MmgIn8Ufynn8v6lzgLrX-A', 'alias': 'han-palace-washington-3', 'name': 'Han Palace', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/Cn_fDw90aeqRCRkaivxd3w/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/han-palace-washington-3?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 58, 'categories': [{'alias': 'dimsum', 'title': 'Dim Sum'}, {'alias': 'cantonese', 'title': 'Cantonese'}, {'alias': 'buffets', 'title': 'Buffets'}], 'rating': 3.7, 'coordinates': {'latitude': 38.914425669693635, 'longitude': -77.06730374662718}, 'transactions': ['delivery', 'pickup'], 'location': {'address1': '1728 Wisconsin Ave NW', 'address2': '', 'address3': None, 'city': 'Washington, DC', 'zip_code': '20007', 'country': 'US', 'state': 'DC', 'display_address': ['1728 Wisconsin Ave NW', 'Washington, DC 20007']}, 'phone': '+12023556725', 'display_phone': '(202) 355-6725', 'distance': 916.8751740548753}, {'id': 'ws2OEuBG41rB5LOq_OE_qg', 'alias': 'kusshi-washington-2', 'name': 'Kusshi', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/LVjCRHER9ye-tlr31F8Z1Q/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/kusshi-washington-2?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 33, 'categories': [{'alias': 'sushi', 'title': 'Sushi Bars'}, {'alias': 'japanese', 'title': 'Japanese'}], 'rating': 4.4, 'coordinates': {'latitude': 38.920617, 'longitude': -77.071394}, 'transactions': ['delivery', 'pickup'], 'location': {'address1': '2309 Wisconsin Ave', 'address2': None, 'address3': '', 'city': 'Washington, DC', 'zip_code': '20007', 'country': 'US', 'state': 'DC', 'display_address': ['2309 Wisconsin Ave', 'Washington, DC 20007']}, 'phone': '+12023333986', 'display_phone': '(202) 333-3986', 'distance': 1312.4811314043586}, {'id': 'D14Ucgt6SytND1-YwoQVZg', 'alias': 'seoulspice-arlington', 'name': 'SeoulSpice', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/0R0uMJAZfoNMUKpY2vm4-w/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/seoulspice-arlington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 79, 'categories': [{'alias': 'korean', 'title': 'Korean'}, {'alias': 'gluten_free', 'title': 'Gluten-Free'}, {'alias': 'comfortfood', 'title': 'Comfort Food'}], 'rating': 4.3, 'coordinates': {'latitude': 38.89580354043643, 'longitude': -77.07056576100732}, 'transactions': ['delivery', 'pickup'], 'location': {'address1': '1735 N Lynn St', 'address2': 'Ste 106', 'address3': '', 'city': 'Arlington', 'zip_code': '22209', 'country': 'US', 'state': 'VA', 'display_address': ['1735 N Lynn St', 'Ste 106', 'Arlington, VA 22209']}, 'phone': '+17034195868', 'display_phone': '(703) 419-5868', 'distance': 1558.6175101395754}, {'id': 'qGO0rs-uNANLexpMZldTtA', 'alias': 'momos-cafe-washington', 'name': "Momo's Cafe", 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/RWajPcG_NmcJ_PbQiCSCzQ/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/momos-cafe-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 215, 'categories': [{'alias': 'asianfusion', 'title': 'Asian Fusion'}, {'alias': 'coffee', 'title': 'Coffee & Tea'}, {'alias': 'taiwanese', 'title': 'Taiwanese'}], 'rating': 4.1, 'coordinates': {'latitude': 38.91684, 'longitude': -77.0965}, 'transactions': ['delivery', 'restaurant_reservation', 'pickup'], 'price': '$$', 'location': {'address1': '4828 MacArthur Blvd NW', 'address2': None, 'address3': '', 'city': 'Washington, DC', 'zip_code': '20007', 'country': 'US', 'state': 'DC', 'display_address': ['4828 MacArthur Blvd NW', 'Washington, DC 20007']}, 'phone': '+12023333675', 'display_phone': '(202) 333-3675', 'distance': 1996.4432142570759}, {'id': '8TcU6v9k3nEKly6WIRMSMA', 'alias': 'shanghai-lounge-washington', 'name': 'Shanghai Lounge', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/Jv1AgdLnp8gKyeKUHDMyLA/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/shanghai-lounge-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 599, 'categories': [{'alias': 'asianfusion', 'title': 'Asian Fusion'}, {'alias': 'shanghainese', 'title': 'Shanghainese'}], 'rating': 3.9, 'coordinates': {'latitude': 38.914586, 'longitude': -77.067402}, 'transactions': ['delivery', 'pickup'], 'price': '$$', 'location': {'address1': '1734 Wisconsin Ave NW', 'address2': '', 'address3': '', 'city': 'Washington, DC', 'zip_code': '20007', 'country': 'US', 'state': 'DC', 'display_address': ['1734 Wisconsin Ave NW', 'Washington, DC 20007']}, 'phone': '+12023381588', 'display_phone': '(202) 338-1588', 'distance': 921.5930713262572}, {'id': 'M9MhHHorL39Gf-Mz7N9oEA', 'alias': 'roll-play-arlington-3', 'name': 'Roll Play', 'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/G3Q8DWhmqL70_1zy3y9ADg/o.jpg', 'is_closed': False, 'url': 'https://www.yelp.com/biz/roll-play-arlington-3?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg', 'review_count': 289, 'categories': [{'alias': 'vietnamese', 'title': 'Vietnamese'}, {'alias': 'coffee', 'title': 'Coffee & Tea'}, {'alias': 'asianfusion', 'title': 'Asian Fusion'}], 'rating': 4.1, 'coordinates': {'latitude': 38.8969768687478, 'longitude': -77.07139654110463}, 'transactions': ['delivery'], 'price': '$$', 'location': {'address1': '1800 N Lynn St', 'address2': 'Ste 102', 'address3': '', 'city': 'Arlington', 'zip_code': '22209', 'country': 'US', 'state': 'VA', 'display_address': ['1800 N Lynn St', 'Ste 102', 'Arlington, VA 22209']}, 'phone': '+15718001881', 'display_phone': '(571) 800-1881', 'distance': 1413.6884844901147}], 'total': 128, 'region': {'center': {'longitude': -77.07557201385498, 'latitude': 38.909268231541304}}}
In [9]:
yelp_json.keys()
Out[9]:
dict_keys(['businesses', 'total', 'region'])
In [10]:
yelp_json["businesses"]
Out[10]:
[{'id': 'IpXiBHLfL1hRyPEIoljA7A',
  'alias': 'ramen-by-uzu-washington-5',
  'name': 'Ramen By Uzu',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/qChXwu3qrKv78J6pg98BPw/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/ramen-by-uzu-washington-5?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 12,
  'categories': [{'alias': 'ramen', 'title': 'Ramen'},
   {'alias': 'comfortfood', 'title': 'Comfort Food'}],
  'rating': 5.0,
  'coordinates': {'latitude': 38.9038, 'longitude': -77.06351},
  'transactions': ['pickup', 'delivery'],
  'location': {'address1': '3210 Grace St NW',
   'address2': None,
   'address3': '',
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['3210 Grace St NW', 'Washington, DC 20007']},
  'phone': '',
  'display_phone': '',
  'distance': 1208.6386840517632},
 {'id': 'hviVXv1CZKWlwbX5JcE2JQ',
  'alias': 'rimtang-washington',
  'name': 'Rimtang',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/nHt8VuSXNb5D_pv8-vQsdQ/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/rimtang-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 45,
  'categories': [{'alias': 'thai', 'title': 'Thai'}],
  'rating': 4.4,
  'coordinates': {'latitude': 38.9047, 'longitude': -77.06586},
  'transactions': ['pickup', 'delivery'],
  'location': {'address1': '1039 33rd St NW',
   'address2': '',
   'address3': None,
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['1039 33rd St NW', 'Washington, DC 20007']},
  'phone': '',
  'display_phone': '',
  'distance': 980.1319873294873},
 {'id': 'HYu17SsplcpRLDjseFfZ_g',
  'alias': 'bangbop-washington',
  'name': 'Bangbop',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/FRTOxwMof-95D_G4ukV-ZA/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/bangbop-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 98,
  'categories': [{'alias': 'korean', 'title': 'Korean'},
   {'alias': 'asianfusion', 'title': 'Asian Fusion'},
   {'alias': 'panasian', 'title': 'Pan Asian'}],
  'rating': 4.6,
  'coordinates': {'latitude': 38.90689510951072,
   'longitude': -77.08214588428672},
  'transactions': ['pickup'],
  'price': '$$',
  'location': {'address1': '4418 MacArthur Blvd NW',
   'address2': 'Unit 1B',
   'address3': '',
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['4418 MacArthur Blvd NW',
    'Unit 1B',
    'Washington, DC 20007']},
  'phone': '+12023500846',
  'display_phone': '(202) 350-0846',
  'distance': 627.0432447708556},
 {'id': 'QanUICteMAzlK7jVADa1JA',
  'alias': 'oki-shoten-washington',
  'name': 'OKI Shoten',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/w4kLjEJHw08_Mm09LJpUtQ/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/oki-shoten-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 309,
  'categories': [{'alias': 'ramen', 'title': 'Ramen'}],
  'rating': 4.0,
  'coordinates': {'latitude': 38.911279798268254,
   'longitude': -77.06564635638217},
  'transactions': ['pickup', 'delivery'],
  'price': '$$',
  'location': {'address1': '1614 Wisconsin Ave NW',
   'address2': '',
   'address3': None,
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['1614 Wisconsin Ave NW', 'Washington, DC 20007']},
  'phone': '+12029448660',
  'display_phone': '(202) 944-8660',
  'distance': 887.4584715879362},
 {'id': 'MmgIn8Ufynn8v6lzgLrX-A',
  'alias': 'han-palace-washington-3',
  'name': 'Han Palace',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/Cn_fDw90aeqRCRkaivxd3w/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/han-palace-washington-3?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 58,
  'categories': [{'alias': 'dimsum', 'title': 'Dim Sum'},
   {'alias': 'cantonese', 'title': 'Cantonese'},
   {'alias': 'buffets', 'title': 'Buffets'}],
  'rating': 3.7,
  'coordinates': {'latitude': 38.914425669693635,
   'longitude': -77.06730374662718},
  'transactions': ['pickup', 'delivery'],
  'location': {'address1': '1728 Wisconsin Ave NW',
   'address2': '',
   'address3': None,
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['1728 Wisconsin Ave NW', 'Washington, DC 20007']},
  'phone': '+12023556725',
  'display_phone': '(202) 355-6725',
  'distance': 916.8751740548753},
 {'id': '8TcU6v9k3nEKly6WIRMSMA',
  'alias': 'shanghai-lounge-washington',
  'name': 'Shanghai Lounge',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/Jv1AgdLnp8gKyeKUHDMyLA/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/shanghai-lounge-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 599,
  'categories': [{'alias': 'asianfusion', 'title': 'Asian Fusion'},
   {'alias': 'shanghainese', 'title': 'Shanghainese'}],
  'rating': 3.9,
  'coordinates': {'latitude': 38.914586, 'longitude': -77.067402},
  'transactions': ['pickup', 'delivery'],
  'price': '$$',
  'location': {'address1': '1734 Wisconsin Ave NW',
   'address2': '',
   'address3': '',
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['1734 Wisconsin Ave NW', 'Washington, DC 20007']},
  'phone': '+12023381588',
  'display_phone': '(202) 338-1588',
  'distance': 921.5930713262572},
 {'id': '_OLog3drIc0XSLjVBHmdnw',
  'alias': 'epicurean-washington',
  'name': 'Epicurean',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/Bi9Xkrv-jE2gvwNHWQWSpw/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/epicurean-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 103,
  'categories': [{'alias': 'delis', 'title': 'Delis'},
   {'alias': 'sushi', 'title': 'Sushi Bars'}],
  'rating': 3.1,
  'coordinates': {'latitude': 38.911049594457, 'longitude': -77.073868110464},
  'transactions': ['delivery'],
  'price': '$$',
  'location': {'address1': '3800 Reservoir Rd NW',
   'address2': '',
   'address3': 'Georgetown University, Darnall Hall',
   'city': 'Washington, DC',
   'zip_code': '20057',
   'country': 'US',
   'state': 'DC',
   'display_address': ['3800 Reservoir Rd NW',
    'Georgetown University, Darnall Hall',
    'Washington, DC 20057']},
  'phone': '+12026252222',
  'display_phone': '(202) 625-2222',
  'distance': 246.9216322969236},
 {'id': 'A4FQLpJtXD9NYZ3MxaZc0Q',
  'alias': 'rice-and-roll-georgetown-washington-3',
  'name': 'Rice & Roll @ Georgetown',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/6mDgrvpQRBXFMF9tz4XCNg/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/rice-and-roll-georgetown-washington-3?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 1,
  'categories': [{'alias': 'fooddeliveryservices',
    'title': 'Food Delivery Services'},
   {'alias': 'salad', 'title': 'Salad'},
   {'alias': 'noodles', 'title': 'Noodles'}],
  'rating': 4.0,
  'coordinates': {'latitude': 38.91364669799805,
   'longitude': -77.06945037841797},
  'transactions': ['delivery'],
  'location': {'address1': None,
   'address2': None,
   'address3': None,
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['Washington, DC 20007']},
  'phone': '+12025808852',
  'display_phone': '(202) 580-8852',
  'distance': 1193.8358685791566},
 {'id': 'LthUk_yvJSBvXfQrUJZYzg',
  'alias': 'georgetown-seafood-washington',
  'name': 'Georgetown Seafood',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/0yf995TuVaoa_UYwl6HhiQ/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/georgetown-seafood-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 473,
  'categories': [{'alias': 'seafood', 'title': 'Seafood'}],
  'rating': 4.7,
  'coordinates': {'latitude': 38.90552, 'longitude': -77.06501},
  'transactions': [],
  'price': '$$',
  'location': {'address1': '1211 Potomac St NW',
   'address2': '',
   'address3': None,
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['1211 Potomac St NW', 'Washington, DC 20007']},
  'phone': '+12026294119',
  'display_phone': '(202) 629-4119',
  'distance': 1003.5406341375556},
 {'id': '81kSCHlkMJsUTTslg6TDgg',
  'alias': 'mai-thai-washington-5',
  'name': 'Mai Thai',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/9SZmH_y6KjW9dVUPplLtSw/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/mai-thai-washington-5?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 543,
  'categories': [{'alias': 'thai', 'title': 'Thai'},
   {'alias': 'sushi', 'title': 'Sushi Bars'},
   {'alias': 'asianfusion', 'title': 'Asian Fusion'}],
  'rating': 3.5,
  'coordinates': {'latitude': 38.9063568115234,
   'longitude': -77.0638732910156},
  'transactions': ['pickup', 'delivery'],
  'price': '$$',
  'location': {'address1': '3251 Prospect St NW',
   'address2': None,
   'address3': '',
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['3251 Prospect St NW', 'Washington, DC 20007']},
  'phone': '+12023372424',
  'display_phone': '(202) 337-2424',
  'distance': 1067.4393986046935},
 {'id': 'oLTxO-XdTO1QmzFU78L1_w',
  'alias': 'osteria-mozza-washington',
  'name': 'Osteria Mozza',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/BRiQLWJt_VwNWEdgt7PvsQ/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/osteria-mozza-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 210,
  'categories': [{'alias': 'italian', 'title': 'Italian'}],
  'rating': 4.0,
  'coordinates': {'latitude': 38.904783, 'longitude': -77.065152},
  'transactions': [],
  'location': {'address1': '3276 M St NW',
   'address2': None,
   'address3': '',
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['3276 M St NW', 'Washington, DC 20007']},
  'phone': '+12022924800',
  'display_phone': '(202) 292-4800',
  'distance': 1026.3194285225811},
 {'id': 'fDoy8diuKRkYKPJHn_rhXw',
  'alias': 'jinya-ramen-bar-georgetown-coming-soon-washington-4',
  'name': 'JINYA Ramen Bar - Georgetown - Coming Soon',
  'image_url': '',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/jinya-ramen-bar-georgetown-coming-soon-washington-4?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 1,
  'categories': [{'alias': 'ramen', 'title': 'Ramen'}],
  'rating': 2.0,
  'coordinates': {'latitude': 38.90994, 'longitude': -77.06432},
  'transactions': [],
  'location': {'address1': '1525 Wisconsin Ave NW',
   'address2': None,
   'address3': None,
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['1525 Wisconsin Ave NW', 'Washington, DC 20007']},
  'phone': '',
  'display_phone': '',
  'distance': 972.1221666991127},
 {'id': 'gwq-QIb-gxNRVAVRuRhLAQ',
  'alias': 'billy-hicks-washington',
  'name': 'Billy Hicks',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/wcoLkGq_JT-90uRTwmTN6A/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/billy-hicks-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 73,
  'categories': [{'alias': 'tradamerican', 'title': 'American'},
   {'alias': 'coffee', 'title': 'Coffee & Tea'},
   {'alias': 'beverage_stores', 'title': 'Beverage Store'}],
  'rating': 3.9,
  'coordinates': {'latitude': 38.9053016170736, 'longitude': -77.0653851},
  'transactions': ['pickup', 'delivery'],
  'location': {'address1': '3277 M St NW',
   'address2': '',
   'address3': None,
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['3277 M St NW', 'Washington, DC 20007']},
  'phone': '+12027925757',
  'display_phone': '(202) 792-5757',
  'distance': 985.6443541150337},
 {'id': 'Umh3f1pPEvg8RBzxDhxQWg',
  'alias': 'taichi-bubble-tea-washington-2',
  'name': 'Taichi Bubble Tea',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/LSjBSTacfqq4_lV8Zo7W_w/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/taichi-bubble-tea-washington-2?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 64,
  'categories': [{'alias': 'bubbletea', 'title': 'Bubble Tea'}],
  'rating': 4.2,
  'coordinates': {'latitude': 38.9081, 'longitude': -77.0635},
  'transactions': [],
  'price': '$$',
  'location': {'address1': '1357 Wisconsin Ave NW',
   'address2': None,
   'address3': '',
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['1357 Wisconsin Ave NW', 'Washington, DC 20007']},
  'phone': '+12025251996',
  'display_phone': '(202) 525-1996',
  'distance': 1053.9163725653268},
 {'id': 'l2ltWPgBBHJU_GcO7rbktA',
  'alias': 'masala-street-eatery-washington',
  'name': 'Masala Street Eatery',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/3ZKQ2-nuHkcFsf_jXMHAtg/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/masala-street-eatery-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 30,
  'categories': [{'alias': 'indpak', 'title': 'Indian'},
   {'alias': 'desserts', 'title': 'Desserts'}],
  'rating': 4.2,
  'coordinates': {'latitude': 38.9077370553025,
   'longitude': -77.06385173049746},
  'transactions': ['pickup', 'delivery'],
  'location': {'address1': '3206 O St NW',
   'address2': '',
   'address3': None,
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['3206 O St NW', 'Washington, DC 20007']},
  'phone': '+12026219650',
  'display_phone': '(202) 621-9650',
  'distance': 1028.304965555873},
 {'id': 'V65fp9Ihx8ej_QDS0pJz4Q',
  'alias': 'wisemillers-grocery-and-deli-washington',
  'name': "Wisemiller's Grocery & Deli",
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/4II7OLHvLIBsiZ7y1WFaeQ/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/wisemillers-grocery-and-deli-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 144,
  'categories': [{'alias': 'delis', 'title': 'Delis'},
   {'alias': 'grocery', 'title': 'Grocery'}],
  'rating': 3.9,
  'coordinates': {'latitude': 38.90632, 'longitude': -77.070475},
  'transactions': ['pickup', 'delivery'],
  'price': '$',
  'location': {'address1': '1236 36th St NW',
   'address2': '',
   'address3': '',
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['1236 36th St NW', 'Washington, DC 20007']},
  'phone': '+12023338254',
  'display_phone': '(202) 333-8254',
  'distance': 551.3204197507296},
 {'id': 'hxM4fKurGzS5WfB9kMTK3A',
  'alias': 'phowheels-food-truck-washington',
  'name': 'PhoWheels Food Truck',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/mnUUrxMFTUz-yfbNFm6mCA/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/phowheels-food-truck-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 422,
  'categories': [{'alias': 'vietnamese', 'title': 'Vietnamese'},
   {'alias': 'foodtrucks', 'title': 'Food Trucks'}],
  'rating': 4.5,
  'coordinates': {'latitude': 38.90828, 'longitude': -77.06291},
  'transactions': [],
  'price': '$',
  'location': {'address1': '',
   'address2': '',
   'address3': '',
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['Washington, DC 20007']},
  'phone': '',
  'display_phone': '',
  'distance': 1193.8358685791566},
 {'id': 'YvqJqlX5HtCtgFbd3KEV3w',
  'alias': '1789-restaurant-and-bar-washington',
  'name': '1789 Restaurant & Bar',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/flvSdEvfDSx6pe63T8OSjg/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/1789-restaurant-and-bar-washington?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 829,
  'categories': [{'alias': 'tradamerican', 'title': 'American'},
   {'alias': 'icecream', 'title': 'Ice Cream & Frozen Yogurt'},
   {'alias': 'bars', 'title': 'Bars'}],
  'rating': 4.2,
  'coordinates': {'latitude': 38.9060275, 'longitude': -77.0704093},
  'transactions': ['pickup', 'delivery'],
  'price': '$$$',
  'location': {'address1': '1226 36th St NW',
   'address2': '',
   'address3': '',
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['1226 36th St NW', 'Washington, DC 20007']},
  'phone': '+12029651789',
  'display_phone': '(202) 965-1789',
  'distance': 573.9413824940102},
 {'id': 'lP04_9tPMKLb9t1v1NhvNQ',
  'alias': 'chick-fil-a-washington-24',
  'name': 'Chick-fil-A',
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/J15Z_F4oiS_prsNZAFQG_A/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/chick-fil-a-washington-24?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 23,
  'categories': [{'alias': 'hotdogs', 'title': 'Fast Food'},
   {'alias': 'chickenshop', 'title': 'Chicken Shop'},
   {'alias': 'salad', 'title': 'Salad'}],
  'rating': 2.3,
  'coordinates': {'latitude': 38.90988358062175,
   'longitude': -77.0745546739316},
  'transactions': [],
  'price': '$',
  'location': {'address1': '3800 Reservoir Rd Nw Hoya Commons Food Ct',
   'address2': '',
   'address3': '',
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['3800 Reservoir Rd Nw Hoya Commons Food Ct',
    'Washington, DC 20007']},
  'phone': '+12029759841',
  'display_phone': '(202) 975-9841',
  'distance': 111.49097640110494},
 {'id': 'pav9wg2UFsyB-dvb7H0OpA',
  'alias': 'martins-tavern-washington-2',
  'name': "Martin's Tavern",
  'image_url': 'https://s3-media0.fl.yelpcdn.com/bphoto/lLOTYi-qcyNr5L4rpuD33g/o.jpg',
  'is_closed': False,
  'url': 'https://www.yelp.com/biz/martins-tavern-washington-2?adjust_creative=GJK5eaHUqVE8eGMl0w0Pfg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=GJK5eaHUqVE8eGMl0w0Pfg',
  'review_count': 1008,
  'categories': [{'alias': 'breakfast_brunch', 'title': 'Breakfast & Brunch'},
   {'alias': 'tradamerican', 'title': 'American'},
   {'alias': 'bars', 'title': 'Bars'}],
  'rating': 3.8,
  'coordinates': {'latitude': 38.9067499, 'longitude': -77.0632304},
  'transactions': ['pickup'],
  'price': '$$',
  'location': {'address1': '1264 Wisconsin Ave NW',
   'address2': '',
   'address3': '',
   'city': 'Washington, DC',
   'zip_code': '20007',
   'country': 'US',
   'state': 'DC',
   'display_address': ['1264 Wisconsin Ave NW', 'Washington, DC 20007']},
  'phone': '+12023337370',
  'display_phone': '(202) 333-7370',
  'distance': 1103.985287125962}]

It returns a long dictionary with the key "businesses" and a list with multiple sub-entries.

How to deal with this data?

Approach 1: Convert all to dataframe and clean it later

In [28]:
# convert to pd
df_yelp = pd.DataFrame(yelp_json["businesses"])

# see
df_yelp

# not looking realy bad. 
Out[28]:
id alias name image_url is_closed url review_count categories rating coordinates transactions location phone display_phone distance price
0 DB9hhm2cB9Iu88RQw6aqCQ thai-and-time-again-washington-2 Thai And Time Again https://s3-media1.fl.yelpcdn.com/bphoto/ESUUM3... False https://www.yelp.com/biz/thai-and-time-again-w... 50 [{'alias': 'thai', 'title': 'Thai'}, {'alias':... 4.6 {'latitude': 38.92376109199186, 'longitude': -... [delivery, pickup] {'address1': '2311 Calvert St NW', 'address2':... +12025061076 (202) 506-1076 2668.901781 NaN
1 XKOVFGUCK1e0vZBML4ddxw donsak-thai-restaurant-washington Donsak Thai Restaurant https://s3-media2.fl.yelpcdn.com/bphoto/btbTD5... False https://www.yelp.com/biz/donsak-thai-restauran... 97 [{'alias': 'thai', 'title': 'Thai'}] 4.4 {'latitude': 38.92398, 'longitude': -77.05212} [delivery, pickup] {'address1': '2608 Connecticut Ave NW', 'addre... +12025078207 (202) 507-8207 2610.575513 NaN
2 RiwIUBITUfhn6etk6qVbnQ eerkins-uyghur-cuisine-washington-2 Eerkin's Uyghur Cuisine https://s3-media2.fl.yelpcdn.com/bphoto/GbQu1A... False https://www.yelp.com/biz/eerkins-uyghur-cuisin... 197 [{'alias': 'noodles', 'title': 'Noodles'}, {'a... 4.3 {'latitude': 38.921397, 'longitude': -77.072513} [delivery, pickup] {'address1': '2412 Wisconsin Ave NW', 'address... +12023333600 (202) 333-3600 1372.544960 $$
3 iHhrBAMa833_hkYfZ5fDoQ simply-banh-mi-washington-6 Simply Banh Mi https://s3-media3.fl.yelpcdn.com/bphoto/YPC8j-... False https://www.yelp.com/biz/simply-banh-mi-washin... 657 [{'alias': 'vietnamese', 'title': 'Vietnamese'... 4.5 {'latitude': 38.9114651, 'longitude': -77.0656... [delivery, pickup] {'address1': '1624 Wisconsin Ave NW', 'address... +12023335726 (202) 333-5726 892.543637 $
4 SPWt2Gqb2-alIq78YINs-w toryumon-japanese-house-arlington-2 Toryumon Japanese House https://s3-media2.fl.yelpcdn.com/bphoto/XAoGmt... False https://www.yelp.com/biz/toryumon-japanese-hou... 234 [{'alias': 'sushi', 'title': 'Sushi Bars'}, {'... 4.3 {'latitude': 38.89405977663849, 'longitude': -... [delivery, pickup, restaurant_reservation] {'address1': '1650 Wilson Blvd', 'address2': '... +15713571537 (571) 357-1537 1700.481085 $$
5 eV_87BqGbpvTqUwjOgQO5g reren-washington-3 Reren https://s3-media3.fl.yelpcdn.com/bphoto/PxQkgC... False https://www.yelp.com/biz/reren-washington-3?ad... 132 [{'alias': 'asianfusion', 'title': 'Asian Fusi... 3.9 {'latitude': 38.90468, 'longitude': -77.06262} [delivery, pickup] {'address1': '1073 Wisconsin Ave NW', 'address... +12028044962 (202) 804-4962 1231.376901 $$
6 QanUICteMAzlK7jVADa1JA oki-bowl-at-georgetown-washington-2 OKI bowl at Georgetown https://s3-media1.fl.yelpcdn.com/bphoto/2AaW1G... False https://www.yelp.com/biz/oki-bowl-at-georgetow... 290 [{'alias': 'ramen', 'title': 'Ramen'}] 3.9 {'latitude': 38.91107, 'longitude': -77.06552} [delivery, pickup] {'address1': '1608 Wisconsin Ave NW', 'address... +12029448660 (202) 944-8660 893.707029 $$
7 M9MhHHorL39Gf-Mz7N9oEA the-happy-eatery-arlington The Happy Eatery https://s3-media1.fl.yelpcdn.com/bphoto/G3Q8DW... False https://www.yelp.com/biz/the-happy-eatery-arli... 250 [{'alias': 'vietnamese', 'title': 'Vietnamese'... 4.1 {'latitude': 38.896769, 'longitude': -77.071233} [delivery] {'address1': '1800 N Lynn St', 'address2': Non... +15718001881 (571) 800-1881 1454.673415 $$
8 Ek_-kvajIvVJbi3ll4pMww pho-75-arlington Pho 75 https://s3-media4.fl.yelpcdn.com/bphoto/g-xbss... False https://www.yelp.com/biz/pho-75-arlington?adju... 2098 [{'alias': 'vietnamese', 'title': 'Vietnamese'... 4.1 {'latitude': 38.8941969403826, 'longitude': -7... [delivery] {'address1': '1721 Wilson Blvd', 'address2': N... +17035257355 (703) 525-7355 1699.743009 $$
9 MmgIn8Ufynn8v6lzgLrX-A han-palace-washington-3 Han Palace https://s3-media2.fl.yelpcdn.com/bphoto/Cn_fDw... False https://www.yelp.com/biz/han-palace-washington... 28 [{'alias': 'dimsum', 'title': 'Dim Sum'}, {'al... 3.6 {'latitude': 38.914425669693635, 'longitude': ... [delivery, pickup] {'address1': '1728 Wisconsin Ave NW', 'address... +12023556725 (202) 355-6725 916.875174 NaN
10 qGO0rs-uNANLexpMZldTtA momos-cafe-washington Momo's Cafe https://s3-media2.fl.yelpcdn.com/bphoto/RWajPc... False https://www.yelp.com/biz/momos-cafe-washington... 201 [{'alias': 'asianfusion', 'title': 'Asian Fusi... 4.1 {'latitude': 38.91684, 'longitude': -77.0965} [delivery, pickup] {'address1': '4828 MacArthur Blvd NW', 'addres... +12023333675 (202) 333-3675 1996.443214 $$
11 xmVrPFMaJ5ko3o1wxjnIZg han-palace-washington-2 Han Palace https://s3-media1.fl.yelpcdn.com/bphoto/HCj0TS... False https://www.yelp.com/biz/han-palace-washington... 295 [{'alias': 'dimsum', 'title': 'Dim Sum'}, {'al... 3.9 {'latitude': 38.92497, 'longitude': -77.05199} [pickup] {'address1': '2649 Connecticut Ave NW', 'addre... +12029690018 (202) 969-0018 2687.396667 $$
12 ws2OEuBG41rB5LOq_OE_qg kusshi-glover-park-washington Kusshi - Glover Park https://s3-media4.fl.yelpcdn.com/bphoto/LVjCRH... False https://www.yelp.com/biz/kusshi-glover-park-wa... 13 [{'alias': 'sushi', 'title': 'Sushi Bars'}, {'... 4.5 {'latitude': 38.920617, 'longitude': -77.071394} [delivery, pickup] {'address1': '2309 Wisconsin Ave', 'address2':... +12023333986 (202) 333-3986 1312.481131 NaN
13 gwq-QIb-gxNRVAVRuRhLAQ billy-hicks-washington Billy Hicks https://s3-media4.fl.yelpcdn.com/bphoto/wcoLkG... False https://www.yelp.com/biz/billy-hicks-washingto... 4 [{'alias': 'tradamerican', 'title': 'American'... 4.5 {'latitude': 38.9053016170736, 'longitude': -7... [delivery, pickup] {'address1': '3277 M St NW', 'address2': '', '... +12027925757 (202) 792-5757 985.644354 NaN
14 dIMNqrq_vOHpLcOdcPCVpA saigon-noodles-and-grill-arlington-2 Saigon Noodles & Grill https://s3-media2.fl.yelpcdn.com/bphoto/OiJgHD... False https://www.yelp.com/biz/saigon-noodles-and-gr... 193 [{'alias': 'vietnamese', 'title': 'Vietnamese'}] 3.8 {'latitude': 38.89396413507029, 'longitude': -... [delivery, pickup] {'address1': '1800 Wilson Blvd', 'address2': '... +17035665940 (703) 566-5940 1724.920728 $$
15 D14Ucgt6SytND1-YwoQVZg seoulspice-arlington SeoulSpice https://s3-media2.fl.yelpcdn.com/bphoto/0R0uMJ... False https://www.yelp.com/biz/seoulspice-arlington?... 64 [{'alias': 'korean', 'title': 'Korean'}, {'ali... 4.4 {'latitude': 38.89580354043643, 'longitude': -... [delivery, pickup] {'address1': '1735 N Lynn St', 'address2': 'St... +17034195868 (703) 419-5868 1558.617510 NaN
16 7cGsqMdKLNV-eXItawA6mA reren-lamen-n-bar-washington Reren Lamen n Bar https://s3-media2.fl.yelpcdn.com/bphoto/PG686K... False https://www.yelp.com/biz/reren-lamen-n-bar-was... 45 [{'alias': 'ramen', 'title': 'Ramen'}, {'alias... 3.8 {'latitude': 38.90468, 'longitude': -77.06241} [] {'address1': '1073 Wisconsin Ave NW', 'address... +12024506654 (202) 450-6654 1240.359423 NaN
17 Lx9N4_5bWxfLTU3f-_8YBw dumplings-and-beyond-washington Dumplings & Beyond https://s3-media3.fl.yelpcdn.com/bphoto/SKfeQ9... False https://www.yelp.com/biz/dumplings-and-beyond-... 605 [{'alias': 'chinese', 'title': 'Chinese'}] 4.1 {'latitude': 38.9211850288095, 'longitude': -7... [delivery, pickup] {'address1': '2400 Wisconsin Ave NW', 'address... +12023383815 (202) 338-3815 1353.517869 $$
18 6MOlZLcCA22fhbGecugyhA kappo-dc-washington Kappo DC https://s3-media4.fl.yelpcdn.com/bphoto/JzUKbe... False https://www.yelp.com/biz/kappo-dc-washington?a... 89 [{'alias': 'japanese', 'title': 'Japanese'}] 4.5 {'latitude': 38.91674042257224, 'longitude': -... [] {'address1': '4822 MacArthur Blvd NW', 'addres... +12028859086 (202) 885-9086 1981.105305 $$$$
19 lQhXiFpO2EE4iYKHNgiphg takeshi-sushi-arlington Takeshi Sushi https://s3-media1.fl.yelpcdn.com/bphoto/Tqi-cE... False https://www.yelp.com/biz/takeshi-sushi-arlingt... 164 [{'alias': 'sushi', 'title': 'Sushi Bars'}, {'... 4.3 {'latitude': 38.8903944478223, 'longitude': -7... [delivery, pickup] {'address1': '2424 Wilson Blvd', 'address2': '... +17032533126 (703) 253-3126 2366.227753 $$

Approach 2: write a function to collect the information you need

Assume you are interested in the id, name, url, lat and long, and rating

In [29]:
# function to clean and extract information from yelp
def clean_yelp(yelp_json):
    '''
    function to extract columns of interest from yelp json
    '''
    # create a temporary dictionary to store the information
    temp_yelp = {}
    
    # collect information
    temp_yelp["id"]= yelp_json["id"]
    temp_yelp["name"]= yelp_json["name"]
    temp_yelp["url"]= yelp_json["url"]
    temp_yelp["latitude"] = yelp_json["coordinates"]["latitude"]
    temp_yelp["longitude"] = yelp_json["coordinates"]["longitude"]
    temp_yelp["rating"]= yelp_json["rating"]
    
    # return
    
    return(temp_yelp)
    
In [32]:
# apply to the dictionary
results_yelp = [clean_yelp(entry) for entry in yelp_json["businesses"]]

# Convert results to dataframe
yelp_df = pd.DataFrame(results_yelp)   
yelp_df.shape
Out[32]:
(20, 6)

Save the json

Remember to always save your response from the API call. You don't want be querying the API all the time to grab the same data.

In [118]:
import json

with open("yelp_results.json", 'w') as f:
    # write the dictionary to a string
    json.dump(response.json(), f, indent=4)

Practice

Make a successful query using your favorite type of food to the Yelp API. Pretty much I only want you to repeat what we did before, but changing the search term a bit

In [ ]:
# code here

Example 3 : YouTube API

Now let's move to our last example.

We will be working with the YouTube API. This is a complex API, but lucky for us some other programmers already created a Python wrapper to access the API. We will use the youtube-data-api library which contains a set of functions to facilitate the access to the API.

What kind of data can you get from the Youtube API?

Youtube has a very extensive api. There are a lot of data you can get access to. See a compreensive list here

What is included in the package:

  • video metadata
  • channel metadata
  • playlist metadata
  • subscription metadata
  • featured channel metadata
  • comment metadata
  • search results

How to Install

The software is on PyPI, so you can download it via pip

In [60]:
#!pip install youtube-data-api

How to get an API key

A quick guide: https://developers.google.com/youtube/v3/getting-started

  1. You need a Google Account to access the Google API Console, request an API key, and register your application. You can use your GMail account for this if you have one.

  2. Create a project in the Google Developers Console and obtain authorization credentials so your application can submit API requests.

  3. After creating your project, make sure the YouTube Data API is one of the services that your application is registered to use.

    a. Go to the API Console and select the project that you just registered.

    b. Visit the Enabled APIs page. In the list of APIs, make sure the status is ON for the YouTube Data API v3. You do not need to enable OAuth 2.0 since there are no methods in the package that require it.

In [33]:
# call some libraries
import os
import datetime
import pandas as pd
In [34]:
#Import YouTubeDataAPI
from youtube_api import YouTubeDataAPI
from youtube_api.youtube_api_utils import *
from dotenv import load_dotenv
In [35]:
# load keys from  environmental var
load_dotenv() # .env file in cwd
api_key = os.environ.get("YT_KEY")
In [36]:
# create a client 
# this is what we call: instantiate the class
yt = YouTubeDataAPI(api_key)
print(yt)
<youtube_api.youtube_api.YouTubeDataAPI object at 0x16a155b10>

Starting with a channel name and getting some basic metadata

Let's start with the LastWeekTonight channel

https://www.youtube.com/user/LastWeekTonight

First we need to get the channel id

In [37]:
channel_id = yt.get_channel_id_from_user('LastWeekTonight')
print(channel_id)
UC3XTzVzaHQEd30rQbuvCtTQ

Channel metadata

In [38]:
# collect metadata
yt.get_channel_metadata(channel_id)
Out[38]:
{'channel_id': 'UC3XTzVzaHQEd30rQbuvCtTQ',
 'title': 'LastWeekTonight',
 'account_creation_date': 1395178899.0,
 'keywords': None,
 'description': 'Breaking news on a weekly basis. Sundays at 11PM - only on HBO.\nSubscribe to the Last Week Tonight channel for the latest videos from John Oliver and the LWT team.',
 'view_count': '4031606887',
 'video_count': '672',
 'subscription_count': '9620000',
 'playlist_id_likes': '',
 'playlist_id_uploads': 'UU3XTzVzaHQEd30rQbuvCtTQ',
 'topic_ids': 'https://en.wikipedia.org/wiki/Politics|https://en.wikipedia.org/wiki/Society|https://en.wikipedia.org/wiki/Television_program|https://en.wikipedia.org/wiki/Entertainment',
 'country': None,
 'collection_date': datetime.datetime(2024, 11, 5, 11, 9, 10, 521314)}

Subscriptions of the channel.

In [39]:
pd.DataFrame(yt.get_subscriptions(channel_id))
Out[39]:
subscription_title subscription_channel_id subscription_kind subscription_publish_date collection_date
0 trueblood UCPnlBOg4_NU9wdhRN-vzECQ youtube#channel 1.395357e+09 2024-11-05 11:10:00.297453
1 GameofThrones UCQzdMyuz0Lf4zo4uGcEujFw youtube#channel 1.395357e+09 2024-11-05 11:10:00.297521
2 HBO UCVTQuK2CaWaTgSsoNkn5AiQ youtube#channel 1.395357e+09 2024-11-05 11:10:00.297578
3 HBOBoxing UCWPQB43yGKEum3eW0P9N_nQ youtube#channel 1.395357e+09 2024-11-05 11:10:00.297635
4 Cinemax UCYbinjMxWwjRpp4WqgDqEDA youtube#channel 1.424812e+09 2024-11-05 11:10:00.297681
5 HBODocs UCbKo3HsaBOPhdRpgzqtRnqA youtube#channel 1.395357e+09 2024-11-05 11:10:00.297746
6 HBOLatino UCeKum6mhlVAjUFIW15mVBPg youtube#channel 1.395357e+09 2024-11-05 11:10:00.297804
7 OfficialAmySedaris UCicerXLHzJaKYHm1IwvTn8A youtube#channel 1.461561e+09 2024-11-05 11:10:00.297867
8 Real Time with Bill Maher UCy6kyFxaMqGtpE3pQTflK8A youtube#channel 1.418342e+09 2024-11-05 11:10:00.297912

List of videos of the channel

You first need to convert the channel_id into a playlist id to get all the videos ever posted by a channel using a function from the youtube_api_utils in the package. Then you can get the video ids, and collect metadata, comments, among many others.

In [40]:
from youtube_api.youtube_api_utils import *
playlist_id = get_upload_playlist_id(channel_id)
print(playlist_id)
UU3XTzVzaHQEd30rQbuvCtTQ
In [41]:
## Get video ids
videos = yt.get_videos_from_playlist_id(playlist_id)
df = pd.DataFrame(videos)
print(df)
        video_id                channel_id  publish_date  \
0    tWZAbKU-JzE  UC3XTzVzaHQEd30rQbuvCtTQ  1.730723e+09   
1    t5lVEMpfRDI  UC3XTzVzaHQEd30rQbuvCtTQ  1.730711e+09   
2    P6grAoS-muM  UC3XTzVzaHQEd30rQbuvCtTQ  1.730387e+09   
3    esymd1F1cRY  UC3XTzVzaHQEd30rQbuvCtTQ  1.730099e+09   
4    qXiEGPWVjGU  UC3XTzVzaHQEd30rQbuvCtTQ  1.729494e+09   
..           ...                       ...           ...   
667  Dh9munYYoqQ  UC3XTzVzaHQEd30rQbuvCtTQ  1.398670e+09   
668  k8lJ85pfb_E  UC3XTzVzaHQEd30rQbuvCtTQ  1.398669e+09   
669  WHCQndalv94  UC3XTzVzaHQEd30rQbuvCtTQ  1.398663e+09   
670  8q7esuODnQI  UC3XTzVzaHQEd30rQbuvCtTQ  1.395379e+09   
671  gdQCtWlhx90  UC3XTzVzaHQEd30rQbuvCtTQ  1.395379e+09   

               collection_date  
0   2024-11-05 11:11:05.203318  
1   2024-11-05 11:11:05.203365  
2   2024-11-05 11:11:05.203455  
3   2024-11-05 11:11:05.203549  
4   2024-11-05 11:11:05.203657  
..                         ...  
667 2024-11-05 11:11:06.617573  
668 2024-11-05 11:11:06.617602  
669 2024-11-05 11:11:06.617631  
670 2024-11-05 11:11:06.617660  
671 2024-11-05 11:11:06.617689  

[672 rows x 4 columns]

Collect video metadata

In [42]:
# id for videos as a list
df.video_id.tolist()
Out[42]:
['tWZAbKU-JzE',
 't5lVEMpfRDI',
 'P6grAoS-muM',
 'esymd1F1cRY',
 'qXiEGPWVjGU',
 'wDSlvMp5knk',
 't-ZXW-KLt7A',
 'yI15h4s6ppM',
 'lDTNFxfOHiM',
 'nD2p1vH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zVCDM',
 'C-YRSqaPtMg',
 'FtdVglihDok',
 'MalsOLSFvX0',
 '-v0XiUQlRLw',
 'Hk011WMM7t0',
 'obCNQ0xksZ4',
 'wqn3gR1WTcA',
 'phieTCxQRLA',
 'RMpCGD7b_H4',
 '-_Y7uqqEFnY',
 'kpYYdCzTpps',
 '-gd8yUptg0Q',
 'EICp1vGlh_U',
 'xX5IV9n223M',
 '8Kfx2fANELo',
 'Gk8dUXRpoy8',
 'qBpiXcyB7wU',
 'liptMbjF3EE',
 '9Y18-07g39g',
 '0nqJvjUNlRA',
 'l5jtFqWq5iU',
 '9W74aeuqsiU',
 'bl-ABuxeWrE',
 'EN9OdruH_qM',
 '27FpoRiStgk',
 'NvpKES_kcYg',
 'dykZyuWci3g',
 'WqD-ATqw3js',
 'uaCaIhfETsM',
 'Ezv8sdTLxKo',
 '_-0J49_9lwc',
 'A51mJjFyG_w',
 'aSZ-hogD8mg',
 'oFetFqrVBNc',
 'zv8ZPFOxJEc',
 '6fiRDJLjL94',
 '29lXsOYBaow',
 'abuQk-6M5R4',
 'sIi_QS1tdFM',
 'vTF-Kz_7L0c',
 'Uf1c0tEGfrU',
 'gPHgRp70H8o',
 'Of3fbIgSqeU',
 'GzFG0Cdh8D8',
 '2xlol-SNQRU',
 'yq_E3HquRJY',
 'Fiu9GSOmt8E',
 'XMGxxRRtmHc',
 'jm9YKT0dItk',
 'WYdi1bL6s10',
 'IhO1FcjDMV4',
 '_v-U3K1sw9U',
 'S5_4wPW6jJQ',
 'qIUb3bjh42Y',
 'EzlCOg-37hI',
 'cMz_sTgoydQ',
 'LyC855KdBKo',
 'sE63HmOYGps',
 'IuVo4fnpLC8',
 'xtdU5RPDZqI',
 '7g0Jh4h5E1E',
 'AytDzZ2ecCc',
 'zeBjxv4oqGU',
 'pkpfFuiZkcs',
 'rBu0BRTx2x8',
 '3ZRE6uVMDAo',
 '1f2iawp0y5Y',
 'hsxukOPEdgg',
 '17oCQakzIl8',
 '0b_eHBZLM6U',
 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zln_4pA8',
 'yzGzB-yYKcc',
 'fesi92d1p68',
 'XEVlyP4_11M',
 'uiN_-AEhTpk',
 'kXYXuXX48m8',
 '0UjpmT5noto',
 'pX8BXH3SJn0',
 'br0NW9ufUUw',
 'CesHr99ezWE',
 'Wpzvaqypav8',
 'poL7l-Uk3I8',
 '2sWRXr2Yu9g',
 '6UsHHOCH4q8',
 'l8QNDRbjong',
 'YQZ2UeOTO3I',
 '3FCioWz7aps',
 '2bbskco60g4',
 'fPloDzu_wcI',
 'P1EtSBxm0S4',
 'eAFnby2184o',
 'X8Buy2X0kFo',
 '9PK-netuhHA',
 'l9qA8c-E_oA',
 'x3Md3O_XfoI',
 'aIMgfBZrrZ8',
 'boI4D1FlIVs',
 'XXCbffp7jLM',
 'MepXBJjsNxs',
 'izUzqUrhbh0',
 'QplQL5eAxlY',
 'fJ9prhPV2PI',
 'tug71xZL7yc',
 'eKEwL-10s7E',
 'DeQqe0oj5Ls',
 '_8m8cQI4DgM',
 '3kEpZWGgJks',
 'ResvfWhi3k8',
 'K4NRJoCNHIs',
 'hkYzuHMcP64',
 'oDPCmmZifE8',
 'xM8qVuc32Rc',
 '-YkLPxQp_y0',
 'xAnw2atT628',
 'HNPRad65-Kg',
 'P8pjd1QEA0c',
 'InSJBzZr414',
 'knbw0gJHHBk',
 'PsB1e-1BB4Y',
 'fYWtbMb8Fhw',
 'KUdHIatS36A',
 'PDylgzybWAw',
 'E_F5GxCwizc',
 '44fCfJQV7yQ',
 'iFaRkscKn_Y',
 'b436uUuf_VI',
 '1Y1ya-yF35g',
 'HKMNKS-9ugY',
 '_Pz3syET3DY',
 'LfgSEwjAeno',
 'rrawNvcF64g',
 'dH573B1bkHI',
 '6clJRsPyuhc',
 'zSQCH1qyIDo',
 'G2W41pvvZs0',
 'QJkiWwMKwSo',
 'WA0wKeokWUU',
 'AJKfs4ZnbNE',
 'hkjkQ-wCZ5A',
 'OPV3D7f3bHY',
 'T8y5EXFMD4s',
 '4Otsft59HuA',
 '3lKYPp2Kp6s',
 'DlJEt2KU33I',
 'NUkjfd95bDM',
 'c3IaKVmkXuk',
 'fpbOEoRrHyU',
 'fDTX_mwj0_8',
 'w2jtOFfiF80',
 'r-ERajkMXw0',
 'EZdH94R6XwQ',
 'XV5w8OFrm6U',
 'IAR3cb1V_ss',
 'j6IZ2TroruU',
 '8YQ_HGvrHEU',
 'We1IvUe6KLo',
 'cjuGCJJUGsg',
 'LxQq8HTtb4A',
 'UkBvsCMxrNU',
 '6GLuuqrNqxQ',
 'Kye2oX-b39E',
 '75bWsqwwOgQ',
 'nJ24vcyJxDs',
 'W6JhcjbWEwg',
 'Bml8KwCmob8',
 'yCY6vYGEN3Q',
 '9vxT1uAhFxA',
 'mxyKJisUgJo',
 'Dh9munYYoqQ',
 'k8lJ85pfb_E',
 'WHCQndalv94',
 '8q7esuODnQI',
 'gdQCtWlhx90']
In [43]:
#grab metadata
video_meta = yt.get_video_metadata(df.video_id.tolist()[:5])
In [44]:
#visualize
pd.DataFrame(video_meta)
Out[44]:
video_id channel_title channel_id video_publish_date video_title video_description video_category video_view_count video_comment_count video_like_count video_dislike_count video_thumbnail video_tags collection_date
0 tWZAbKU-JzE LastWeekTonight UC3XTzVzaHQEd30rQbuvCtTQ 1.730723e+09 Election 2024: Last Week Tonight with John Oli... A quick message ahead of Tuesday’s election. A... 24 3226457 12958 149494 None https://i.ytimg.com/vi/tWZAbKU-JzE/hqdefault.jpg 2024-11-05 11:11:38.505363
1 t5lVEMpfRDI LastWeekTonight UC3XTzVzaHQEd30rQbuvCtTQ 1.730711e+09 S11 E28: Trump’s Businesses & Election 2024: 1... John Oliver addresses undecided voters about K... 24 278975 922 10961 None https://i.ytimg.com/vi/t5lVEMpfRDI/hqdefault.jpg 2024-11-05 11:11:38.505401
2 P6grAoS-muM LastWeekTonight UC3XTzVzaHQEd30rQbuvCtTQ 1.730387e+09 Lee Greenwood: Last Week Tonight with John Oli... John Oliver discusses Lee Greenwood – the man ... 24 2466222 7440 89906 None https://i.ytimg.com/vi/P6grAoS-muM/hqdefault.jpg 2024-11-05 11:11:38.505429
3 esymd1F1cRY LastWeekTonight UC3XTzVzaHQEd30rQbuvCtTQ 1.730099e+09 S11 E27: Mass Deportations & Lee Greenwood: 10... John Oliver discusses Donald Trump’s plans to ... 24 398849 1404 14489 None https://i.ytimg.com/vi/esymd1F1cRY/hqdefault.jpg 2024-11-05 11:11:38.505467
4 qXiEGPWVjGU LastWeekTonight UC3XTzVzaHQEd30rQbuvCtTQ 1.729494e+09 S6 E10: Lethal Injections, William Barr & Aust... Season 6, episode 10. May 5th, 2019. John Oliv... 24 115921 183 2647 None https://i.ytimg.com/vi/qXiEGPWVjGU/hqdefault.jpg 2024-11-05 11:11:38.505590
In [45]:
## Collect Comments
ids = df.video_id.tolist()[:5]
In [46]:
ids
Out[46]:
['tWZAbKU-JzE', 't5lVEMpfRDI', 'P6grAoS-muM', 'esymd1F1cRY', 'qXiEGPWVjGU']
In [47]:
# loop
list_comments = []

for video_id in ids:
    comments = yt.get_video_comments(video_id, max_results=10)
    list_comments.append(pd.DataFrame(comments))

# concat
df = pd.concat(list_comments)
df.head()
Out[47]:
video_id commenter_channel_url commenter_channel_id commenter_channel_display_name comment_id comment_like_count comment_publish_date text commenter_rating comment_parent_id collection_date reply_count
0 tWZAbKU-JzE http://www.youtube.com/@mkapper9800 UC3nWfjjcRUKT_qi25EHuJVQ @mkapper9800 UgyiNkNYpknnGr7lmRJ4AaABAg 0 1.730841e+09 Unfunniest clown on TV none None 2024-11-05 11:12:20.871746 0
1 tWZAbKU-JzE http://www.youtube.com/@mistercohaagen UCSc-qTqlGQ37wzfnzJaogcQ @mistercohaagen UgzDab7SH-hV37269694AaABAg 0 1.730841e+09 Imagine fleeing a country ruined by religious ... none None 2024-11-05 11:12:20.871795 0
2 tWZAbKU-JzE http://www.youtube.com/@patmullarkey7659 UCQNZVAAF23D__1rr6GKStig @patmullarkey7659 UgyZ7WDFXrnvD6YGgJZ4AaABAg 0 1.730841e+09 My Dad was an immigrant. Every time Trump spew... none None 2024-11-05 11:12:20.871831 0
3 tWZAbKU-JzE http://www.youtube.com/@SindyxLotus UCqqD1Q7JN5VNp-OEZuQdCqQ @SindyxLotus UgyGFHyHjlxi9YCFPq14AaABAg 0 1.730841e+09 JUST DO IT none None 2024-11-05 11:12:20.871867 0
4 tWZAbKU-JzE http://www.youtube.com/@ffejgib UCLWfVga8ito9XW46aYI2Upg @ffejgib UgwuohaqEhy1LDzYYRB4AaABAg 0 1.730841e+09 What comedians would do for a paycheck. none None 2024-11-05 11:12:20.871901 0

The youtube API also allows you to search for most popular videos using queries. This is very cool!

In [50]:
df = pd.DataFrame(yt.search(q='they are eating the dogs', max_results=10))
df.keys()
df
Out[50]:
video_id channel_title channel_id video_publish_date video_title video_description video_category video_thumbnail collection_date
0 5llMaZ80ErY Atlanta News First UCWElIIlFx2JiyI9UVrbrEcw 1.726037e+09 Trump: They&#39;re eating the dogs, the cats Former President Donald Trump claims immigrant... None https://i.ytimg.com/vi/5llMaZ80ErY/hqdefault.jpg 2024-11-05 11:14:04.751331
1 V5CR7HkByC4 CNBC Television UCrp_UI8XtuYfpiqluWLD7Lw 1.726040e+09 Former President Trump claims immigrants are &... Vice President Harris and Former President Tru... None https://i.ytimg.com/vi/V5CR7HkByC4/hqdefault.jpg 2024-11-05 11:14:04.751365
2 IStRiNCfbkw The Sean Ward Show UCEvLUnQiH-i1XUNikh0Zm4g 1.726512e+09 They&#39;re Eating the Dogs! They&#39;re Eatin... They're Eating the Dogs! They're Eating the Ca... None https://i.ytimg.com/vi/IStRiNCfbkw/hqdefault.jpg 2024-11-05 11:14:04.751389
3 lHycpIhnFcU WSJ News UCMliswJ7oukCeW35GSayhRA 1.726052e+09 ‘They&#39;re Eating the Dogs:&#39; Trump Makes... Former President Donald Trump falsely claimed ... None https://i.ytimg.com/vi/lHycpIhnFcU/hqdefault.jpg 2024-11-05 11:14:04.751412
4 3BrCvZmSnKA The Kiffness UCFy846QdKs3LbLgBpSqPcdg 1.726247e+09 The Kiffness - Eating the Cats ft. Donald Trum... Stream / Buy "Eating the Cats" here: https://o... None https://i.ytimg.com/vi/3BrCvZmSnKA/hqdefault.jpg 2024-11-05 11:14:04.751434
5 Uq7FcWLDEtk WatchMojo.com UCaWd5_7JhbQBe4dknZhsHJg 1.726177e+09 They&#39;re Eating The Dogs In Springfield! The second US debate gave us lots of unbelieva... None https://i.ytimg.com/vi/Uq7FcWLDEtk/hqdefault.jpg 2024-11-05 11:14:04.751455
6 I_V1mfGcfMQ Joey Graceffa UCGCPAOQDZa_TTTXDr5byjww 1.726201e+09 They’re Eating The Dogs None https://i.ytimg.com/vi/I_V1mfGcfMQ/hqdefault.jpg 2024-11-05 11:14:04.751477
7 yx4e0hFmzzg Eyewitness News ABC7NY UCrlIS7z20CnVaCrMvdkig_g 1.726041e+09 Trump pushes false claim that Haitian migrants... Check out more Eyewitness News - http://abc7ny... None https://i.ytimg.com/vi/yx4e0hFmzzg/hqdefault.jpg 2024-11-05 11:14:04.751497
8 H-jiH6IgvjM schmoyoho UCNYrK4tc5i1-eL8TXesH2pg 1.726105e+09 They&#39;re Eating The Dogs - Trump vs. Harris... The debate last night got weird, but the weird... None https://i.ytimg.com/vi/H-jiH6IgvjM/hqdefault.jpg 2024-11-05 11:14:04.751519
9 zwEDBRfUe_M FRANCE 24 English UCQfwfsi5VrQ8yKZ-UWmAEFg 1.727045e+09 FRANCE 24 interviews producer of viral Donald ... Musician and producer David Scott "The Kiffnes... None https://i.ytimg.com/vi/zwEDBRfUe_M/hqdefault.jpg 2024-11-05 11:14:04.751541
In [11]:
!jupyter nbconvert _week-08_apis.ipynb --to html --template classic
[NbConvertApp] Converting notebook _week-08_apis.ipynb to html
[NbConvertApp] Writing 461791 bytes to _week-08_apis.html