ikin Posted November 18, 2010 Share Posted November 18, 2010 Well I'm trying to learn regex so I can use it on my bot but I can't seem to do it right... I was using http://www.spaweditor.com/scripts/regex/index.php for a while and came up with this: /watch\?v=(.*)/ To parse: iIp7OnHXBlo out of But it only ended taking the new word to like if I had Cake is good http://www.youtube.com/watch?v=iIp7OnHXBlo do you like cake? it would take with the iIp7OnHXBlo do you like cake? instead of only the iIp7OnHXBlo So yea I need some help... Code: if (preg_match('/watch\?v=(.*)/', $dh->getircTrailing()." ", $trackkeys)) { if ($trackkeys != "") { $feedURL = 'http://gdata.youtube.com/feeds/api/videos/' . $trackkey[1]; $entry = simplexml_load_file($feedURL); $video = parseVideoEntry($entry); $dh->reply("[Youtube} Title: {$video->title} | By: {$video->author} (uploaded on " . convert_tz($video->published, UTC) . ") | Duration: " . sprintf("%0.2f", $video->length / 60) . " | Views: {$video->viewCount} | Rating: {$video->rating}"); } } Quote Link to comment Share on other sites More sharing options...
ikin Posted November 18, 2010 Author Share Posted November 18, 2010 I'll found out that I can use /v=(\w*)/ To myself: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.