Welcome Guest, Not a member yet? Register   Sign In
Codeigniter IMDb Scraper Library
#1

[eluser]Unknown[/eluser]
Hello,

I made an IMDb scraper library to get movie information for a project that i'm working on. And thought I would share it. A quick note, IMDB.com does not allow scraping their site... If this doesn't bother you(I didn't), then you can proceed.

Here are some of the main features:

*Diffrent scrape options to refine your results
*Includes a light mode to make searching faster
*Youtube trailer url in the final results, also has options available in the config
*More to follow...


Example code:
application/controller/search_controller.php
Code:
//Load the scraper library
$this->load->library('imdb');

//Check if the query is submitted
if(isset($this->input->post('query'))) {
    $query = $this->input->post('query'); //Put the query in a variable
    $data['moviedetails'] = $this->imdb->getMovieInfo($query); //Get the movie information
}

//Set the page title
$data['title'] = 'IMDb Search Page';

//Load the view and pass along the data
$this->load->view('search_view', $data);

application/views/search_view.php
Code:
<!DOCTYPE html>
&lt;head&gt;
    &lt;title&gt;&lt;?php echo $title;>&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form method="post"&gt;
        &lt;input type="text" name="query"&gt;
        &lt;input type="submit" value="Search"&gt;
    &lt;/form&gt;
    <br>
    &lt;?php
        if(isset($moviedetails)){
            foreach($moviedetails as $detail){
                echo '<pre>';
                print_r($detail);
                echo '/<pre>';
            }
        }
    ?&gt;
&lt;/body&gt;

If there any bugs, please report them. Thank you.
Also, if you have any ideas, suggestions etc, let me know and I'll try to incorparate them.

https://github.com/Tony0892/Codeigniter-IMDb-Scraper




Theme © iAndrew 2016 - Forum software by © MyBB