PHP Web Scraper

Discussion in 'PHP' started by platinumn23, Feb 15, 2012.

  1. #1
    I'm looking for a PHP Script that will scrape (download) videos from break.com, youtube, and hulu -- does anyone know of such a script or can anyone do this? I can download from youtube and break but not hulu =\

    Any help would be greatly appreciated!!
     
    platinumn23, Feb 15, 2012 IP
  2. Brandon.

    Brandon. Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I may be wrong but I don't believe there are any easy ways to create a Hulu scraper/downloader.
     
    Brandon., Feb 20, 2012 IP
  3. uleesgold

    uleesgold Member

    Messages:
    288
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #3
    I haven't even tried this code for scraping myself, but could this work for that:

    <?php
    // Advanced cURL Scrape
    // Obtain data from url and force links to work
    // This code was written by Michael Devaney
    // Note: You might want to cache this
    // All I ask is that you do not remove these notes
    // Thank you
    $ch = curl_init ("http://www.theurl.com"); //URL to Scrape
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $page = curl_exec($ch);

    preg_match('#</p[^>]*>(.+?)</p>#is', $page, $matches, $links); // grabs anything between <p> </p> tags
    foreach ($matches as &$match) {
    $match = str_replace('href="', 'href="http://www.theurl.com', $match);
    //This is used to make sure links work.
    }
    // output html, styles, and more.
    echo '<head>';
    echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'; // make sure its able to be read correctlly
    echo '</head>';
    echo '<style type="text/css"></style>'; //add styles here
    echo '<body>';
    echo '<img src="http://www.yoursite.com/image.jpg">'; //Maybe add an image over the scaped data
    echo '<h1>cURL Scrape</h1>';
    echo $matches[1]; // change [1] to [2] If you want to grab data between the second <p></p> tags
    echo '</body>';
    ?>

    I guess that scraping text or images might be simpler than scraping videos or other multimedia.
     
    uleesgold, Feb 23, 2012 IP
  4. ratnadewi

    ratnadewi Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    no, scrapting hulu not that easy. hulu is a real streaming media. not like youtube that have cache of the video.
     
    ratnadewi, Mar 8, 2012 IP
  5. RobertStev

    RobertStev Peon

    Messages:
    92
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    you will have to do stream caputuring
     
    RobertStev, Mar 10, 2012 IP