---
title: "Web Scraping Excercise"
author: "Akshay Kulkarni "
output: pdf_document
---


In this excercise we will learn how to use rvest to scrape the IMDB website for our favorite movie data.

#Task 1 - Building a dataframe from full cast page of a movie of your choice and storing ONLY the cast info i.e. the Actor and their respective character name in a df.

1.Use rvest to request and store the data from the url e.g. "https://www.imdb.com/title/tt4154796/fullcredits?ref_=tt_cl_sm#cast" 
Write R statements to answer the following questions on the retrieved contents:
. How many nodes are direct descendents of the HTML <body> element (the actual visible content of a web page)?
. What are the nodes names of the direct descendents of the <body>?
. What is the css selector to select the characters ?



#Task 2 - Building a dataframe for most popular(top 100) feature films in 2018 and generate some statistics and some plots to gain insight.
Your final dataframe should contain these following columns.

-Rank: The rank of the film from 1 to 100 on the list of 100 most popular feature films released in 2018.
-Title: The title of the feature film.
-Description: The description of the feature film.
-Runtime: The duration of the feature film.
-Genre: The genre of the feature film,
-Rating: The IMDb rating of the feature film.

after compiling your final dataframe answer the following questions.

. What was the average runtime for movies in 2018 ? 
. Which was the leading genre for movies in 2018 ?
. Explore any variable/s in your data set and generate a plot. (Give any Inference you may discover from this)
. Choose another previous year i.e 2016 nd compare your results.

