This is a discussion on Parsing youtube video id within the Coding Help forums, part of the Webmaster Help category; Has anyone got any experience parsing the video id from youtube urls in php. ie. youtube.com/watch?v= R0BA-KviNO4 &feature=related Where the ...
| |||||||
| Register | Forum Rules | FAQ | Donate | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Has anyone got any experience parsing the video id from youtube urls in php. ie. youtube.com/watch?v=R0BA-KviNO4&feature=related Where the red is the part I want. |
| |||||
| what language ?
__________________ Forbairt Media | Web Design & Development Galway / Dublin, Ireland - coming soon ... ( vague but descriptive isn't it ) Recent Work: Safari Club African Safari Holidays - South Africa Safaris Other Stuff: FluffyLinkulator Rapid Inclusion Service Tools |
| |||||
| actually judging on your selfmade cms ... I'll assume php ? Code:
$string = "youtube.com/watch?v=R0BA-KviNO4&feature=related";
preg_match('/v\=(.+)&/',$string,$matches);
echo $matches[1];
__________________ Forbairt Media | Web Design & Development Galway / Dublin, Ireland - coming soon ... ( vague but descriptive isn't it ) Recent Work: Safari Club African Safari Holidays - South Africa Safaris Other Stuff: FluffyLinkulator Rapid Inclusion Service Tools |
| ||||
| I just cracked it without regular expressions from a little googling. Here is the code it allows you to enter the url of a youtube vid in to a form and the code processes the form to parse the video id and insert it in to an embed code with preset values. PHP Code: cheers for your help.. Last edited by johned; 09-07-2008 at 04:13 PM. |
| |||||
| ah fair enough I'd assumed it'd be part of a multiline post or something similar not just a URL you had
__________________ Forbairt Media | Web Design & Development Galway / Dublin, Ireland - coming soon ... ( vague but descriptive isn't it ) Recent Work: Safari Club African Safari Holidays - South Africa Safaris Other Stuff: FluffyLinkulator Rapid Inclusion Service Tools |
| Tags |
| parsing, video, youtube |
| Thread Tools | |
| Display Modes | |
|
|
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| IrishVids.com - New YouTube? | decbohan22 | General Chat | 6 | 16-07-2008 04:46 PM |
| Youtube API (gdata) + Zend framework on shared hosting | failsafe | Coding Help | 2 | 29-04-2008 10:18 AM |
| suggestions: youtube plugin for wordpress | davidbehan | Webmaster Discussion | 1 | 17-10-2007 05:10 PM |
| YouTube encouraged homicide suspect to surrender, say police | Busarus | General Chat | 0 | 21-12-2006 07:38 PM |
| Google buy Youtube | Cormac | General Chat | 4 | 13-10-2006 09:25 PM |