Hi, I have youtubetomp3 site, www.YoutubeToMP3.me, Now I have problem with videos that contain unusual chars, like ";,/ PHP: etc. Here is the 2 functions that Saved the name from youtube: function ExtractSongTrackName($vidSrc, $srcType) { $name = ''; $vidSrcTypes = $this->GetVidSrcTypes(); if (in_array($srcType, $vidSrcTypes)) { $vidSrc = ($srcType == $vidSrcTypes[1]) ? file_get_contents($vidSrc) : $vidSrc; if ($vidSrc !== false && eregi('eow-title',$vidSrc)) { $name = end(explode('eow-title',$vidSrc)); $name = current(explode('">',$name)); $name = end(explode('title="',$name)); } } return $name; } PHP: private function SetSongFileName($file_contents) { $vidSrcTypes = $this->GetVidSrcTypes(); $trackName = $this->ExtractSongTrackName($file_contents, $vidSrcTypes[0]); return $this->_songFileName = (!empty($trackName)) ? self::_SONGFILEDIR . preg_replace('/_{2,}/','_',preg_replace('/ /','_',preg_replace('/^[A-Za-z0-9]+$/','',$trackName))) . '.mp3' : ''; } PHP: Regards.
return $this->_songFileName = (!empty($trackName)) ? self::_SONGFILEDIR . preg_replace('/_{2,}/','_',preg_replace('/ /','_',preg_replace('/[^A-Za-z0-9 _]$/','',$trackName))) . '.mp3' : ''; PHP:
Oops, typo. return $this->_songFileName = (!empty($trackName)) ? self::_SONGFILEDIR . preg_replace('/_{2,}/','_',preg_replace('/ /','_',preg_replace('/[^A-Za-z0-9 _]/','',$trackName))) . '.mp3' : ''; PHP: If this doesn't work, then give more detail. Do you get an error? Do you get a result you didn't expect?
Now it's work with unusual chars, but with Hebrew language, don't work. I need that it'll work both. Regards.