This is a simple python scraping for the FilmAffinity.
pip install python-filmaffinity
git clone [email protected]:sergiormb/python_filmaffinity.git cd python_filmaffinity python setup.py install
requests >= 2.0.1 requests-cache >= 0.4.13 bs4 >= 0.0.1
import python_filmaffinity
service = python_filmaffinity.FilmAffinity()
movie = service.get_movie(title='Celda 211')
movie['title']
Celda 211
movie['rating']
7.7
movie['directors']
['Daniel MonzĂłn']
movie['actors']
['Luis Tosar', 'Alberto Ammann', 'Antonio Resines', 'Carlos Bardem', 'Marta Etura', 'Vicente Romero', 'Manuel MorĂłn', 'Manolo Solo', 'Fernando Soto', 'Luis Zahera', 'Patxi Bisquert', 'FĂ©lix Cubero', 'Josean Bengoetxea', 'Juan Carlos Mangas', 'JesĂşs Carroza']
- Spanish: 'es'
- USA, UK: 'en'
- MĂ©xico: 'mx'
- Argentina: 'ar'
- Chile: 'cl'
- Colombia: 'co'
- Example
import python_filmaffinity
service = python_filmaffinity.FilmAffinity(lang='en')
Parameter | Required | Type | Description |
---|---|---|---|
title | False | String | Search for the title of the movie |
cast | False | String | Search movies by actor |
director | False | String | Search movies by the director |
from_year | False | String | Search start date |
to_year | False | String | Search end date |
- Example
movies = service.search(cast='Nicolas Cage')
Parameter | Required | Type | Description |
---|---|---|---|
id | False | String | FilmAffinity id |
title | False | String | Get movie by title |
trailer | False | Boolean | Return movie with trailer |
images | False | Boolean | Return movie with images |
- Example
movies = service.get_movie(title='Avatar')
movies = service.get_movie(id='495280')
Parameter | Required | Type | Description |
---|---|---|---|
from_year | False | String | Search start date |
to_year | False | String | Search end date |
top | False | Integer | Number of elements |
- Example
movies = service.top_filmaffinity()
movies = service.top_filmaffinity(from_year=2010, to_year=2011)
Parameter | Required | Type | Description |
---|---|---|---|
top | False | Integer | Number of elements |
- Example
movies = service.top_premieres()
Parameter | Required | Type | Description |
---|---|---|---|
top | False | Integer | Number of elements |
- Example
movies = service.top_netflix()
movies = service.top_hbo(top=5)
movies = service.top_filmin()
movies = service.top_movistar()
movies = service.top_rakuten()
movies = service.top_tv_series()
Parameter | Required | Type | Description |
---|---|---|---|
trailer | False | Boolean | Return movie with trailer |
images | False | Boolean | Return movie with images |
- Example
movies = service.recommend_netflix()
movies = service.recommend_hbo()
movies = service.recommend_filmin()
movies = service.recommend_movistar()
movies = service.recommend_rakuten()
- Scrapping updated
- Fixed errors in get_country
- When images are requested, lets provide also the country where they were published (@jcea)
- Correctly provide the trailers listed in filmaffinity (@jcea)
- Spurious search in youtube deleted (@jcea)
- Extract correctly when multiple genres (@jcea)
- Added "writers", "music", "cinematography" and "producers" (@jcea)
- Regression processing "original_title" in searches (@jcea)
- Deleted spaces at the end of the title (@jcea)
- Added original_title (@jcea)
- Fix directors scraping (@jcea)
- Search by genre
- Fixed errors
- Adds proxies and random user-agent in headers
- Changed description
- Fixed errors
- Fixed errors with SSL
- Replaces cachetools for requests-cache
- Add images
- Fixed errors
- Fixes encoding for the analyzed results
- Disabled limitations for all the supported languages
- Change of name to the main class.
- Adds initial language check and raise error if this is not in support
- Adds basic exceptions
- Add cachetools
- Fixed errors
- Top new DVDs
- Get movie with trailer
- Top TV series
- Return movies list with raiting
- Top Netlfix, HBO and Filmin
- Recommendation from Netflix, HBO or Filmin
- Fixed errors
- Search movies by title, year, director or cast.
- Get the filmaffinity top and search by year
- Get the premieres top
- Initial release.
- Sergio Pino, [email protected], sergiormb.github.io
- opacam https://github.com/opacam
- jcea - https://www.jcea.es/ - https://blog.jcea.es/ - https://github.com/jcea
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.