How can I scrape data of ```title``` and ```genres``` in Russian?

68 views Asked by At

Here is my code, so how can I scrap data of title and genres in Russian or any other language (now I have it in English)?

from imdb import IMDb

def scrape_movie_info(movie_id):
    ia = IMDb('http', useModule='http')
    movie = ia.get_movie(movie_id)#

    print("Название: ", movie["title"])
    print("Рейтинг: ", movie["rating"])
    print("Жанры: ", movie["genres"])
    print("Описание: ", movie["plot outline"])#

movie_id = "20225374"
scrape_movie_info(movie_id)
1

There are 1 answers

0
tevemadar On BEST ANSWER

There seem to be multiple fields:

  • movie['title'] usually produces an English title
  • movie['original title'] is the title of the movie in its country of origin
  • and there is a movie['localized title'] which may already give you Russian title, based on your IP and/or system settings.

Then according to a feature request in their issue tracker, https://github.com/cinemagoer/cinemagoer/issues/329, you can specify preferred languages in the initialization,

ia = imdb.IMDb('https', languages='it-IT')

is the example there, and it presumably becomes

ia = IMDb('http', useModule='http', languages='ru-RU')

when applied to your particular code.