Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1686 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Filtering video code using PHP/JS/HTML

Thread title: Filtering video code using PHP/JS/HTML
Reply    
    Thread tools Search this thread Display Modes  
11-28-2009, 10:16 PM
#1
santa is offline santa
santa's Avatar
Status: Member
Join date: Mar 2009
Location: Location: location.
Expertise: Design, HTML
Software: Espresso, Photoshop, Mail.app
 
Posts: 398
iTrader: 7 / 100%
 

santa is on a distinguished road

Send a message via ICQ to santa Send a message via AIM to santa Send a message via MSN to santa Send a message via Yahoo to santa Send a message via Skype™ to santa

  Old  Filtering video code using PHP/JS/HTML

I'm currently in the developing process of my new site, Vidmarkr, which automatically bookmarks videos when you input the URL.

The trouble I'm having is getting the video's HTML to be filtered out of the page, ready to go onto mine.

For example, in the page http://www.youtube.com/watch?v=qeye8wnBJoU, I want to extract the code:

PHP Code:
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/qeye8wnBJoU&hl=en_US&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/qeye8wnBJoU&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object
Any ideas?

Thanks,

B.

Reply With Quote
11-28-2009, 11:30 PM
#2
Jeff Andersen is offline Jeff Andersen
Status: Superstar
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 4,449
iTrader: 10 / 100%
 

Jeff Andersen is on a distinguished road

  Old

Isn't the embed code the same for all videos? (aside from the video id)
Why not just take the video ID and put it into the generic code rather than scraping the page.

Reply With Quote
11-28-2009, 11:39 PM
#3
santa is offline santa
santa's Avatar
Status: Member
Join date: Mar 2009
Location: Location: location.
Expertise: Design, HTML
Software: Espresso, Photoshop, Mail.app
 
Posts: 398
iTrader: 7 / 100%
 

santa is on a distinguished road

Send a message via ICQ to santa Send a message via AIM to santa Send a message via MSN to santa Send a message via Yahoo to santa Send a message via Skype™ to santa

  Old

Well, it'd be different from different sites, e.g Vimeo, I guess, but I need to find how to scrape the code anyway. How'd I do this?

Reply With Quote
11-28-2009, 11:46 PM
#4
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

If I recall correctly (a very quick test seemed to agree) YouTube uses JavaScript to inject the Flash into the page so you won't be able to scrape the player code directly.

If the video is available for embedding, you could grab the code from the "embed code" textbox.

Reply With Quote
11-28-2009, 11:51 PM
#5
santa is offline santa
santa's Avatar
Status: Member
Join date: Mar 2009
Location: Location: location.
Expertise: Design, HTML
Software: Espresso, Photoshop, Mail.app
 
Posts: 398
iTrader: 7 / 100%
 

santa is on a distinguished road

Send a message via ICQ to santa Send a message via AIM to santa Send a message via MSN to santa Send a message via Yahoo to santa Send a message via Skype™ to santa

  Old

Is there a way you could scrape the text from that embed code textbox then?

Thanks!

Reply With Quote
11-29-2009, 12:06 AM
#6
Jeff Andersen is offline Jeff Andersen
Status: Superstar
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 4,449
iTrader: 10 / 100%
 

Jeff Andersen is on a distinguished road

  Old

Well, either way for each website you'd need a new method to scrape or put the video ID in.

The less complicated way is to just have your script recognize the URL they've input and then insert that into the code samples from each site.

Otherwise even if you did try to cURL the embed code it's a) gonna be a heavier script than needed and b) will have to be handled differently for each site anyway.

Reply With Quote
Reply    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed