InfoPage

For retriveing the information on movies/dramas there is a function used to scrape the data from the specified webpage and a container class to store the results in an effective manner.

info()

def info(url: str)


This function is used to retrieve movie/drama data from the webpage.

Parameters:

  • link(str) - The url for the MDL webpage containing information on Movies/Dramas.

Raises:

  • InvalidURLError - The entered URL was not a valid one.

  • NotMDLError - The entered URL did not belong to MDL.

  • RequestTimeoutError - There was some error getting the response from the server.

  • BadHttpResponseError - Did not get a positive response from the server.

Returns:

All the data that was extracted from the webpage in the InfoPage object.

Return type:

InfoPage

InfoPage

class InfoPage

This is the container class whose object contains all the data extracted from the webpage.

Supported Operations:

str(x) - Will return the name of the Cast/Artist the object contains details about.

Attributes:

  • title(str) - Name of the movie/drama.

  • thumbnail(str) - A link to thumbnail obtained directly from the website.

  • type(str) - Indicates weather it is a drama or a movie.

  • url(str) - The url that was used for scraping the data.

  • ratings(str) - The rating that the movie has.

  • synopsis(str) - A short plot of the movie/drama.

  • casts(list) - All actors that were involved in the movie/drama.

  • native(str) - The name of the movie in its native language.

  • genre(str) - The genre the movie belongs to.

  • duration(str) - The runtime of movie or each episode of a drama.

  • country(str) - The country of origin.

  • aka(list) - Aliases of the movie/drama.

  • director(str) - The person who directed the movie/drama.

  • screenwriter(str) - The writer of the movie/drama.

  • date(str) - The release date of the movie/drama.

  • reco(list) - The recommendations MDL suggests based on the current movie/drama.

  • reviews(list) - The user reviews for the current movie/drama.

Note: reco and reviews are empty at the time of object creation. It will be populated only after calling the get_recommendations() and get_reviews() methods respectively.

Methods:

def save(self, file)


Saves the data in the object to a file in JSON format.

Parameters:

  • file(str) - The name of the file to save the data into.

Returns:

Returns a boolean value that indicates weather the data was saved successfully or not.

Return Type:

bool

def to_json(self)


Returns a json formatted string of the data present in the object.

Returns:

The json formatted string.

Return Type:

str

def dumps(self)


Returns a dict of data with attributes as keys and value as attribute’s value.

Returns:

A dict of data present in the object.

Return Type:

dict

def get_recommendations(self)


Used to get recommendations based on current movie/drama. The data will be stored in reco.

def get_reviews(self)


Used to get reviews current movie/drama. The data will be stored in reviews.