In this article we will see how we can get the campany information in the XML format. Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. Company object contains all the information about the company which is related to film industry and has records at IMDb data base.
In order to get this we have to do the following
1. Import the IMDbPY module
2. Create a instance of IMDB
3. Get the company object with the help of get_company method which requires movie ID
4. Get the XML format value here it will be in string by converting the company object into XML
Below is the implementation
# importing the module import imdb # creating instance of IMDb ia = imdb.IMDb() # id code = "0051941" # getting information company = ia.get_company(code) # printing company print(company) print("--------------------------------") # converting company object into XML file xml_file = company.asXML() # printing some part of the XML file print(xml_file[:250]) |
Output :
Marvel Studios -------------------------------- <?xml version="1.0"? <!DOCTYPE company SYSTEM "http://imdbpy.sf.net/dtd/imdbpy68.dtd" <company id="0051941" access-system="http"Marvel Studios</nameMarvel Studios</long-imdb-name</compan
Another example
# importing the module import imdb # creating instance of IMDb ia = imdb.IMDb() # id code = "0022125" # getting information company = ia.get_company(code) # printing company print(company) print("--------------------------------") # converting company object into XML file xml_file = company.asXML() # printing some part of the XML file print(xml_file[:100]) |
Output :
Pixel -------------------------------- <?xml version="1.0"? <!DOCTYPE company SYSTEM "http://imdbpy.sf.net/dtd/imdbpy68.dtd" <company id
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
Recommended Posts:
- Python IMDbPY – Series Information in XML format
- Python IMDbPY – Person Information in XML format
- Python IMDbPY – Movies Information in XML format
- Python IMDbPY – Retrieving company using company ID
- Python IMDbPY – Default info of Company object
- Python IMDbPY – Company info set
- Python IMDbPY – Searching a company
- Python IMDbPY – Getting name from searched company
- Python IMDbPY – Getting company ID from searched companies
- Python IMDbPY – Getting Series Countries as XML
- Python IMDbPY – Getting Series Run times as XML
- Python IMDbPY – Getting Series Genres as XML
- Python IMDbPY – Getting Series Cast as XML
- Python IMDbPY – Movie info set
- Python IMDbPY – Getting released year of movie from movie object
- Python IMDbPY – Person info set
- Python IMDbPY – Default info of Movie object
- Python IMDbPY – Getting bottom 100 movies
- Python IMDbPY – Getting top 250 movies
- Python IMDbPY – Default info of Person object
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

