Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

imdb engine not fetching production country

Help
qwerty759
2010-09-25
2013-04-15
  • qwerty759
    qwerty759
    2010-09-25

    today i noticed that the imdb engine doesn't fetch production country anymore.
    i don't know how long this is going on.

    Maybe ucanmexwise can look in to this too?
    I know i post a lot in the help forum lately, but in the mean time i will try to find a solution to this problem as well

     
  • qwerty759
    qwerty759
    2010-09-25

    uvanmexwise

    Maybe this will help sort this out. i found it at the videodb imdb search engine:

    // Countries
        preg_match('/<h5>Country:<\/h5>(.+?)<\/div>/si', $resp, $ary);
        preg_match_all('/<A HREF="\/Sections\/Countries\/.+?\/">(.+?)<\/A>/si', $ary, $ary, PREG_PATTERN_ORDER);
        $data  = trim(join(', ', $ary));

    it's the same as their latest svn version so maybe it is helpful

     
  • qwerty759
    qwerty759
    2010-09-25

    i found another code at izzysoft.de in their imdb search engine

    #-----------------------------------
      /** Get country of production
       * @method country
       * @return array country (array of string)
       * @see IMDB page / (TitlePage)
       */
      public function country() {
       if (empty($this->countries)) {
        if ($this->page == "") $this->openpage ("Title");
        $this->countries = array();
        if (preg_match_all("/\/Sections\/Countries\/\w+\/\"\&gt;\s*(.*?)<\/a/m",$this->page,$matches))
          for ($i=0;$i<count($matches);++$i) $this->countries = $matches;
       }
       return $this->countries;
      }

    i also found there code for the also known as title. because sometimes the aka doesn't work at all and sometimes only one title most of the time the top or bottom one.

    #------------------------------------------
      /** Get movies alternative names
       * @method alsoknow
       * @return array aka array of array; searching
       *         on akas.imdb.com will add "lang" (2-char language code) to the array
       *         for localized names, "country" may hold multiple countries separated
       *         by commas
       * @see IMDB page / (TitlePage)
       * @version Due to changes on the IMDB sites, neither the languages nor the year
       *          seems to be available anymore - so those array properties will always
       *          be empty, and kept for compatibility only (for a while, at least).
       */
      public function alsoknow() {
       if (empty($this->akas)) {
        if ($this->page == "") $this->openpage ("Title");
        $ak_s = strpos ($this->page, "Also Known As:</h5>");
        if ($ak_s>0) $ak_s += 45;
        if ($ak_s == 0) $ak_s = strpos ($this->page, "Alternativ:");
        if ($ak_s == 0) return array();
        $alsoknow_end = strpos ($this->page, "</div>", $ak_s);
        $alsoknow_all = substr($this->page, $ak_s, $alsoknow_end - $ak_s);
        $aka_arr = explode("<br>",str_replace("\n","",$alsoknow_all));
        foreach ($aka_arr as $aka) {
          $aka = trim($aka);
          if (strpos('class="tn15more"',$aka)>0) break; // end of list
          if (empty($aka)) continue;
          if ( strpos($aka,'tn15more')!==FALSE ) break;
          preg_match('!"(.*?)"\s*-\s*(.*)!ims',$aka,$match);
          $title = $match;
          $countries = explode( ', ', $match );
          foreach( $countries as $country ){
            $comment = '';
            if ( preg_match('!(.*?)\s*(<em>.*</em>)!ims',$country,$match2) ) {
                $country = $match2;
                preg_match_all('!<em>\((.*?)\)</em>!ims',$match2,$matches);
                $comment = implode( ', ', $matches );
            }
            $this->akas = array(
                "title"=>preg_replace('|(\&lt;.*?\&gt;)|','',$title),
                "year"=>'',
                "country"=>preg_replace('|(\&lt;.*?\&gt;)|','',$country),
                "comment"=>preg_replace('|(\&lt;.*?\&gt;)|','',$comment),
                "lang"=>''
            );
          }
        }
       }
       return $this->akas;
      }

     
  • ucanmexwise
    ucanmexwise
    2010-09-26

    I've updated the archives "install_ajax-filmdb_1.2.4.zip" and "update_ajax-filmdb_1.2.3-1.2.4.zip" at http://www.netzgesta.de/archive/

     
  • qwerty759
    qwerty759
    2010-09-26

    Many thanks for the updated installer!
    You even include all the latest issuses from the help forum! Great!
    And best of all the production country works again! thanks again.

    ps
    was the code that i found helpful or not? i just try to help find solutions, and if someone else already found the answer, we don't have to invent it ourselves i think