Results 1 to 2 of 2

Thread: Postin my latest few youtube videos?

  1. #1
    Join Date
    Apr 2010

    Smile Postin my latest few youtube videos?

    I don't know if this is the right section for this, so sorry if it's not.

    I found this simple script for having my latest tweet on my site:

    And I was wondering if youtube had a similar feature, where I could have the thumbnails and links to my last few youtube videos on my site.

  2. #2
    Join Date
    Jun 2008
    Screenscrape it with PHP.

    PHP Code:
    <title>Your Youtube Videos ScreenScraper</title> 

    //Your YouTube user name would go there instead of mine!//
    //Above this line, ALL WORKS FINE! //////////////////////////////////////////////////// 

    // FOR you the $getpage should be the entire html you display on the page 
    $explodefirst explode('<div class="scrollbox-body">',$page); 
    $headerisgone $explodefirst[1]; 
    $explodesecond explode('<div class="scrollbox-separator">',$headerisgone); 
    $endresult $explodesecond[0]; 

    //You can use str_replace to change style elements, link base urls, etc.
    $endresult = str_replace('bgcolor="#2b4c3f"','', $endresult); 
    $endresult = str_replace('width="325"','width="345"', $endresult); 
    $endresult str_replace('href="/','target="_blank" rel="nofollow" href="http://www.youtube.com/'$endresult); //setting links to open in new window, nofollow and base YouTube.

    print '<div class="scrollbox-body">'//putting back the DIV we removed in the first function
    print $endresult
    I tested it and it works.
    You can get the general idea and tinker with it to show your latest vids.
    You can copy the elements you need from the Youtube stylesheet, and use my str_replace to reset the correct URLs, etc.
    Last edited by donatello; 04-24-2010 at 06:44 PM.

    Privacy Policy Generator

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center