[DEVELOPMENT] Movies python parser (IMDb & kinopoisk) [TOOL]

in #utopian-io5 years ago

I'm used to watch films a lot. And it's a kind of classic problem - to choose what is the best.

python-kinoparser.png

As I mostly agree with the large audience, so I usually like the films people like the most, so I decided to write a small python application that can help you with choosing the correct film. And now I'm sharing the sources with you in case you're wondering or maybe you would like to developing some better stuff.

About project... What is it?

kinoparser.jpg

This software is for the kinomaniacs. If you watch films frequently and often it's hard to choose for you the correct film, just grab a list of currently shown films in the cinema or maybe your own list of the films that you would like to see. Give this list to the python script and get recommendations in less than a minute. Easy as that!

Also, you can use this code to make different output: CSV/TSV and others, too (thanks to PrettyTable). Review its documentation for this. And you can use this repo if you want to learn a bit of python, or maybe something about PrettyTable or IMDb / Kinopoisk API.

Requirements (or used technologies)

  • Python 3 (probably will still work with python 2, but you'll have to manage to rewrite some stuff)
  • IMDb-py library - it's used to connect to IMDb
  • (optional, but recommended) PrettyTable library - it's used to display results in a pretty table :)
  • (optional) Kinopoisk library - it's used to fetch rating results also from Kinopoisk website
  • git - to clone this repo
  • internet and PC :D - to clone the repo and connect to IMDb/Kinopoisk

Installation

I'm not covering installation of Python 3 here. It's already installed in most of the Linux distributions. Please google if you need help in installation of Python.

Please choose whenever you like to install (minimal, normal or full)

  • Minimal: sudo pip install IMDbpy - this will install only IMDb python library
  • Normal: sudo pip install IMDbpy PrettyTable - this installes IMDb and PrettyTable
  • Full: sudo pip install IMDbpy PrettyTable kinopoiskpy - this will install all 3 tools (IMDb, PrettyTable and Kinopoisk libraries)

What are the files here?

There are 3 python files in there:

  • imdb-plaintext.py - to run it, you need only python 3 and IMDb library installed (minimal installation)
  • imdb-prettytable.py - to run it, you need python 3, IMDb and PrettyTable installed (normal installation)
  • imdb-kinopoisk-prettytable.py - to run it, you need all tools from the requirements (full installation)

How to run?

That's probably the easiest. First, clone the repo (if you don't have git installed, for ubuntu just do: sudo apt install git):
git clone https://github.com/sxiii/kinoparser

Ok, the scripts should have been downloaded. Now let's check them:
cd kinoparser && ls

It should show you 3 python scripts (imdb-plaintext.py, imdb-prettytable.py and imdb-kinopoisk-prettytable.py). In this case everything is corrent and we're already in the scripts directory, so just run them in linux CLI:
python ./name-of-the-choosen-script.py

For example, for full installation, run:

  • python ./imdb-kinopoisk-prettytable.py
    For normal installation, run:
  • python ./imdb-prettytable.py
    For minimal installation, run:
  • python ./imdb-plaintext.py
    Or, if you have python 2 installed as default python interpretator, then
    python3 ./name-of-the-choosen-script.py - edit this accordingly.

Manipulating data

You could easily remove or add data that you need/don't need. You have to do it every time only in two places: in the heading (t.field_names), and in the print row (t.add_row). If you would like to add your own, please read the IMDBpy docs here: https://imdbpy.readthedocs.io and Kinopoisk help here: https://github.com/ramusus/kinopoiskpy

Roadmap / Further development

  • improve the speed of loading data
  • make it possible to give file input with comma/tab/newline separated list of films
  • make the script parse some popular websites with films by itself

How to contribute / Issues

If you have any questions, problems, errors, issues, and cannot google them out (so they are related to the kinoparser source code), please create a github issue and show your errors etc.

If you want to contribute some improvement feel free to make a pull request. Your contribution will be mentioned in the project.

Github Repo: Kinoparser

https://github.com/sxiii/kinoparser

Github Account: @sxiii

https://github.com/sxiii

Thank you for reviewing the project and hope it will help you. Please feel free to comment and discuss, suggest improvements, both here in comment section and on github.

Happy coding,
Den Ivanov aka @sxiii from Bergen, Norway

Sort:  

Thank you for your contribution @sxiii I am sure this is useful for a movie fan.

  1. I find no comments
  2. The commit messages could be more descriptive.
  3. all the three files could be extracted to a common class e.g. MovieDB so that you can pass different command line options instead of 3 files with basically similar logics. Also the MovieDB class could be customised with different parameters.
  4. You could consider adding tests
  5. It would be good to support parameters like returning the TOP 10 popular movies by ratings or date.

Thanks!

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

@justyy thanks. This is an idea from my mind which was realized and rewritten few times already. I hope it will get comments soon. I totally agree with your idea on making it a common class! And I will look forward to add tests and making it more like a CLI tool if I see that this project will be used but someone on github. Thanks again for your in-depth review! Maybe someone could help me a little with python =)))

Thank you for your review, @justyy! Keep up the good work!

Nice project. This is a good idea. I struggle to find good movies these days.

Posted using Partiko iOS

Hey @jmjury thanks. Hope you like the idea and subscribe / participate in github, in this case I will surely add some improvements from time to time!

Hi @sxiii!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @sxiii!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Hello @sxiii! This is a friendly reminder that you have 3000 Partiko Points unclaimed in your Partiko account!

Partiko is a fast and beautiful mobile app for Steem, and it’s the most popular Steem mobile app out there! Download Partiko using the link below and login using SteemConnect to claim your 3000 Partiko points! You can easily convert them into Steem token!

https://partiko.app/referral/partiko

Congratulations @sxiii! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

Click here to view your Board

Do not miss the last post from @steemitboard:

Carnival Challenge - Collect badge and win 5 STEEM
Vote for @Steemitboard as a witness and get one more award and increased upvotes!

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.030
BTC 58635.35
ETH 3152.96
USDT 1.00
SBD 2.44