Giter VIP home page Giter VIP logo

csfd-api's Introduction

ČSFD API

Build Status Coverage Status Dependencies

WIP

This is a WIP version 2.0. The stable library is available at branch 1.x.

Installation

composer require mikulas/csfdapi "@dev"

or download packages manually

License MIT

The MIT License (MIT)

Copyright (c) 2013 Mikuláš Dítě

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.

csfd-api's People

Contributors

mikulas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

csfd-api's Issues

Some movies returns blank plot

Some movies (For example The Great Gatsby - ID 293006) returns blank plot.

Thats caused because of csfd.cz source code. This movie does not contains the "P" element in movie description.

I've created hotfix in class Movie.
After

$plot = [];
            foreach ($content->find('p') as $paragraph) {
                $text = trim($paragraph->innertext);
                if (strlen($text) > 10) { // skip meaningless glues
                    $plot[] = $text;
                }
            }

Add

if (empty($plot)) {
                $text = $content->innertext;
                if (strlen($text) > 10) {
                    $plot[] = strip_tags($text);
                }
            }

IMDB id

Could you please add parsing IMDB id (or at least IMDB url) of the movie for /movie/[i:id] API call?
Thank you.

Nedostupnost API

Ahoj,

můžu se zeptat jestli bude API dostupná do tohoto čtvrtka?

Strange behaviour in movie detail

Hi,

I noticed, that e.g. url http://csfdapi.cz/movie/346385?type=html returns two different results:

The good one:

 REMOVE the "?type=html" parameter from your request to get raw JSON

{
  "id": 346385,
  "year": 2015,
  "poster_url": "http://img.csfd.cz/files/images/film/posters/160/008/160008100_9890e5.jpg?h180",
  "names": {
    "cs": "Popelka",
    "originální": "Cinderella",
    "sk": "Popoluška"
  },
  "genres": [
    "Dobrodružný",
    "Drama",
    "Rodinný",
    "Romantický",
    "Fantasy"
  ],
  "countries": [
    "USA",
    "Velká Británie"
  ],
  "rating": 75,
  "plot": "Děj snímku Popelka sleduje osudy mladé Elky (Lily James), jejíž otec, kupec, se po smrti její matky znovu ožení. Elka má svého tatínka velice ráda, a tak se snaží ke své nové maceše (Cate Blanchett) a jejím dvěma dcerám Anastázii (Holliday Grainger) a Drizele (Sophie McShera) chovat vstřícně, a dělá všechno proto, aby se ve svém novém domově cítily dobře. Když ale Elčin otec nečekaně zemře, Elka zjistí, že je vydána na milost své nové žárlivé a kruté rodiny. Zanedlouho se z ní stane obyčejná služka, věčně umouněná od popela, které ostatní posměšně říkají Popelka. Navzdory krutostem, kterým je nucena čelit, ale Elka neztrácí naději a je rozhodnuta řídit se posledním přáním své matky, aby vždy byla „odvážná a laskavá\". Nehodlá propadnout zoufalství, ani pohrdat těmi, kteří s ní jednají špatně. A pak je tu ještě jistý pohledný cizinec, se kterým se setkala v lesích. Elka, která nemá nejmenší tušení, že se ve skutečnosti jedná o prince, a nikoliv o pouhého učedníka ze zámku, má pocit, že konečně potkala spřízněnou duši. Záhy nato se zdá, že by se na ni konečně mohlo usmát štěstí. Všechny dívky z širokého okolí jsou totiž sezvány do královského paláce na bál a Elka se těší, že by se tam mohla znovu setkat s okouzlujícím Kitem (Richard Madden). Macecha jí však návštěvu bálu zakáže a zlomyslně jí roztrhá šaty. Jako ve všech správných pohádkách je však pomoc nablízku a objevuje se kouzelná víla kmotřička (Helena Bonham-Carter), která – proměnou dýně a několika myšek – Popelčin život navždy změní.",
  "content_rating": "Mládeži přístupný",
  "runtime": "114 min",
  "authors": {
    "directors": [
      {
        "id": 147,
        "name": "Kenneth Branagh",
        "api_url": "/author/147",
        "csfd_url": "http://www.csfd.cz/tvurce/147"
      }
    ],
    "script": [
      {
        "id": 3647,
        "name": "Chris Weitz",
        "api_url": "/author/3647",
        "csfd_url": "http://www.csfd.cz/tvurce/3647"
      }
    ],
    "camera": [
      {
        "id": 74356,
        "name": "Haris Zambarloukos",
        "api_url": "/author/74356",
        "csfd_url": "http://www.csfd.cz/tvurce/74356"
      }
    ],
    "soundtrack": [
      {
        "id": 62994,
        "name": "Patrick Doyle",
        "api_url": "/author/62994",
        "csfd_url": "http://www.csfd.cz/tvurce/62994"
      }
    ],
    "actors": [
      {
        "id": 76148,
        "name": "Lily James",
        "api_url": "/author/76148",
        "csfd_url": "http://www.csfd.cz/tvurce/76148"
      },
      {
        "id": 67763,
        "name": "Richard Madden",
        "api_url": "/author/67763",
        "csfd_url": "http://www.csfd.cz/tvurce/67763"
      },
      {
        "id": 62,
        "name": "Cate Blanchett",
        "api_url": "/author/62",
        "csfd_url": "http://www.csfd.cz/tvurce/62"
      },
      {
        "id": 271,
        "name": "Helena Bonham Carter",
        "api_url": "/author/271",
        "csfd_url": "http://www.csfd.cz/tvurce/271"
      },
      {
        "id": 50170,
        "name": "Nonso Anozie",
        "api_url": "/author/50170",
        "csfd_url": "http://www.csfd.cz/tvurce/50170"
      },
      {
        "id": 157,
        "name": "Stellan Skarsgård",
        "api_url": "/author/157",
        "csfd_url": "http://www.csfd.cz/tvurce/157"
      },
      {
        "id": 94672,
        "name": "Sophie McShera",
        "api_url": "/author/94672",
        "csfd_url": "http://www.csfd.cz/tvurce/94672"
      },
      {
        "id": 66679,
        "name": "Holliday Grainger",
        "api_url": "/author/66679",
        "csfd_url": "http://www.csfd.cz/tvurce/66679"
      },
      {
        "id": 311,
        "name": "Derek Jacobi",
        "api_url": "/author/311",
        "csfd_url": "http://www.csfd.cz/tvurce/311"
      },
      {
        "id": 2233,
        "name": "Ben Chaplin",
        "api_url": "/author/2233",
        "csfd_url": "http://www.csfd.cz/tvurce/2233"
      },
      {
        "id": 30538,
        "name": "Hayley Atwell",
        "api_url": "/author/30538",
        "csfd_url": "http://www.csfd.cz/tvurce/30538"
      },
      {
        "id": 33635,
        "name": "Rob Brydon",
        "api_url": "/author/33635",
        "csfd_url": "http://www.csfd.cz/tvurce/33635"
      },
      {
        "id": 57702,
        "name": "Alex MacQueen",
        "api_url": "/author/57702",
        "csfd_url": "http://www.csfd.cz/tvurce/57702"
      },
      {
        "id": 154738,
        "name": "Eloise Webb",
        "api_url": "/author/154738",
        "csfd_url": "http://www.csfd.cz/tvurce/154738"
      },
      {
        "id": 179952,
        "name": "Michael Jenn",
        "api_url": "/author/179952",
        "csfd_url": "http://www.csfd.cz/tvurce/179952"
      },
      {
        "id": 141918,
        "name": "Andrew Fitch",
        "api_url": "/author/141918",
        "csfd_url": "http://www.csfd.cz/tvurce/141918"
      },
      {
        "id": 86371,
        "name": "Edward Lewis French",
        "api_url": "/author/86371",
        "csfd_url": "http://www.csfd.cz/tvurce/86371"
      },
      {
        "id": 123055,
        "name": "Jd Roth-round",
        "api_url": "/author/123055",
        "csfd_url": "http://www.csfd.cz/tvurce/123055"
      },
      {
        "id": 92550,
        "name": "Julian Seager",
        "api_url": "/author/92550",
        "csfd_url": "http://www.csfd.cz/tvurce/92550"
      },
      {
        "id": 135016,
        "name": "Leila Wong",
        "api_url": "/author/135016",
        "csfd_url": "http://www.csfd.cz/tvurce/135016"
      },
      {
        "id": 183138,
        "name": "Ella Smith",
        "api_url": "/author/183138",
        "csfd_url": "http://www.csfd.cz/tvurce/183138"
      },
      {
        "id": 199574,
        "name": "Adetomiwa Edun",
        "api_url": "/author/199574",
        "csfd_url": "http://www.csfd.cz/tvurce/199574"
      }
    ],
    "": [
      {
        "id": 73045,
        "name": "Simon Kinberg",
        "api_url": "/author/73045",
        "csfd_url": "http://www.csfd.cz/tvurce/73045"
      }
    ]
  },
  "api_url": "/movie/346385",
  "csfd_url": "http://www.csfd.cz/film/346385"
}

and the bad one:

REMOVE the "?type=html" parameter from your request to get raw JSON

{
  "id": 346385,
  "names": {
    "cs": ""
  },
  "api_url": "/movie/346385",
  "csfd_url": "http://www.csfd.cz/film/346385"
}

These two result can be obtained by refreshing the page http://csfdapi.cz/movie/346385?type=html.

Issue when parsing this film

Hi,
first of all thanks for great api . 👏
I have encountered this issue:
when parsing: http://csfdapi.cz/movie?search=Dobrodru%C5%BEstv%C3%AD%20u%20%C4%8Cern%C3%A9ho%20mo%C5%99e%20&type=html
I obtain info without

  "year": 1972,

means this:

  {
    "id": 215221,
    "poster_url": "http://img.csfd.cz/files/images/film/posters/000/046/46650_eece27.jpg?h180",
    "names": {
      "cs": "Dobrodružství u Černého moře"
    },
    "genres": [
      "Rumunsko"
    ],
    "countries": [
      "1972"
    ],
    "authors": {
      "directors": [
        {
          "id": 42835,
          "name": "Savel Stiopul",
          "api_url": "/author/42835",
          "csfd_url": "http://www.csfd.cz/tvurce/42835"
        }
      ],
      "actors": [
        {
          "id": 38113,
          "name": "Mihai Vasile Boghita",
          "api_url": "/author/38113",
          "csfd_url": "http://www.csfd.cz/tvurce/38113"
        },
        {
          "id": 38932,
          "name": "Florin Piersic",
          "api_url": "/author/38932",
          "csfd_url": "http://www.csfd.cz/tvurce/38932"
        }
      ]
    },
    "api_url": "/movie/215221",
    "csfd_url": "http://www.csfd.cz/film/215221"
  },

When parsing from :
http://csfdapi.cz/movie/215221?type=html
output is with year information:

{
  "id": 215221,
  "year": 1972,
  "poster_url": "http://img.csfd.cz/files/images/film/posters/000/046/46650_eece27.jpg?h180",
  "names": {
    "cs": "Dobrodružství u Černého moře",
    "rumunsko": "Aventuri la Marea Neagra"
  },
  "countries": [
    "Rumunsko"
  ],
  "plot": "všechny komentáře uživatele \t\t\t\t/",
  "authors": {
    "directors": [
      {
        "id": 42835,
        "name": "Savel Stiopul",
        "api_url": "/author/42835",
        "csfd_url": "http://www.csfd.cz/tvurce/42835"
      }
    ],
    "actors": [
      {
        "id": 38113,
        "name": "Mihai Vasile Boghita",
        "api_url": "/author/38113",
        "csfd_url": "http://www.csfd.cz/tvurce/38113"
      },
      {
        "id": 38932,
        "name": "Florin Piersic",
        "api_url": "/author/38932",
        "csfd_url": "http://www.csfd.cz/tvurce/38932"
      },
      {
        "id": 31127,
        "name": "Marcel Anghelescu",
        "api_url": "/author/31127",
        "csfd_url": "http://www.csfd.cz/tvurce/31127"
      },
      {
        "id": 42835,
        "name": "Savel Stiopul",
        "api_url": "/author/42835",
        "csfd_url": "http://www.csfd.cz/tvurce/42835"
      },
      {
        "id": 46030,
        "name": "Carmen María Strujac",
        "api_url": "/author/46030",
        "csfd_url": "http://www.csfd.cz/tvurce/46030"
      },
      {
        "id": 46057,
        "name": "Corina Chiriac",
        "api_url": "/author/46057",
        "csfd_url": "http://www.csfd.cz/tvurce/46057"
      },
      {
        "id": 46483,
        "name": "Zephi Alsec",
        "api_url": "/author/46483",
        "csfd_url": "http://www.csfd.cz/tvurce/46483"
      }
    ]
  },
  "api_url": "/movie/215221",
  "csfd_url": "http://www.csfd.cz/film/215221"
}

names vs name

chyba klíče u struktury Movie. Pokud parsuji json data z url /movie/[i:id], tak je klíč pojmenován names, pokud ale parsuji json data z url /author/[i:id] a snažím se získat výčet filmů (např. author-filmography-director), pak je klíč pojmenován name. Přitom z api by se mělo jednat o stejnou strukturu Movie, tudíž by klíč měl být v obou případech names.

not an actual issue, deploy as a heroku app with silex?

hey there.
thanks for the api in the first place! it worked pretty well though, however the last few days were little bumpy, and now the main site hosting this api ("http://csfdapi.cz/") doesn't work at all. i've been thinking about hosting it on my own a lot of the times before, and now's the perfect time i guess. it should correspond with the license you provided, and i guessed you could provide me some basic tips.
will use it for parsing stuff, basically, and my question is pretty simple (sorry, not really an issue) – how to deploy this on a heroku–based provider with silex framework/something similar? it's been a while since i wrote anything in php and it would be a great help if you'd gave me a few tips a tricks. i guess there's just a router and some basic controllers to add, right?
thanks a lot, man, just for your time you spend on this.
–adam

names "en" to response

Ahoj, at first thanks for API.
Could you please add parsing of english name to response of request /movie?search=[key word]. I mean names["en"]. Actualy there is just names["cs"]. It would really help. You actually have it in movie/[id] request. Would you know when it could be add If you would like to incorporate it?
Thanks a lot Jiri.

Nemožný přístup přes XMLHttpRequest

Zdravím, bylo by možné k API dopsat hlavičku: Access-Control-Allow-Credentials: true. Nyní není možné se připojit přes ajaxový request, snažím se využít této API v jedné aplikaci a tohle je trošku problém.

Add .gitignore

Add .gitignore and block composer.lock & content of vendor dir (without htaccess).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.