Status
Not open for further replies.

ChaoscripT

Active Member
1,005
2010
11
20
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:
PHP:
        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' : '';
        }


Regards.
 
2 comments
What exactly is your problem? :)
If you want to apply RegEx to them, you can escape the chars with a backslash (if needed).
 
I want that the songs names will be in the same like youtube name.
But I have problem with unusual chars, How I can delete them or something?
I also wants that it'll worked with Hebrew language.

Regards.
 
Status
Not open for further replies.
Back
Top