From bfa133dbef1bc6db7409e03a4cfcf0104c61c320 Mon Sep 17 00:00:00 2001 From: Jat Date: Mon, 11 Mar 2013 21:02:50 +0800 Subject: [PATCH] regular expression --- common.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/common.php b/common.php index c44a199..a917633 100644 --- a/common.php +++ b/common.php @@ -8,6 +8,7 @@ *v1.04 百度BAE云存储(BCS)版 Modified by Jat *http://www.sinosky.org */ + define('SAESPOT_VER', '1.04'); if (!defined('IN_SAESPOT')) exit('error: 403 Access Denied'); @@ -183,32 +184,32 @@ function set_content($text,$spider='0'){ // 各大网站的视频地址格式经常变,能识别一些,不能识别了再改。 // youku if(strpos($text, 'player.youku.com')){ - $text = preg_replace('/http:\/\/player.youku.com\/player.php\/sid\/([a-zA-Z0-9\=]+)\/v.swf/', '', $text); + $text = preg_replace('/http:\/\/player\.youku\.com\/player\.php\/sid\/([a-zA-Z0-9=]+)\/v\.swf/', '', $text); } if(strpos($text, 'v.youku.com')){ - $text = preg_replace('/http:\/\/v.youku.com\/v_show\/id_([a-zA-Z0-9\=]+)(\/|.html?)?/', '', $text); + $text = preg_replace('/http:\/\/v\.youku\.com\/v_show\/id_([a-zA-Z0-9=]+)(\/|\.html?)?/', '', $text); } // tudou if(strpos($text, 'www.tudou.com')){ if(strpos($text, 'programs/view')){ - $text = preg_replace('/http:\/\/www.tudou.com\/(programs\/view|listplay)\/([a-zA-Z0-9\=\_\-]+)(\/|.html?)?/', '', $text); + $text = preg_replace('/http:\/\/www\.tudou\.com\/(programs\/view|listplay)\/([a-zA-Z0-9=_-]+)(\/|\.html?)?/', '', $text); }else if(strpos($text, 'albumplay')){ - $text = preg_replace('/http:\/\/www.tudou.com\/albumplay\/([a-zA-Z0-9\=\_\-]+)\/([a-zA-Z0-9\=\_\-]+)(\/|.html?)?/', '', $text); + $text = preg_replace('/http:\/\/www\.tudou\.com\/albumplay\/([a-zA-Z0-9=_-]+)\/([a-zA-Z0-9=_-]+)(\/|\.html?)?/', '', $text); }else{ - $text = preg_replace('/http:\/\/www.tudou.com\/(programs\/view|listplay)\/([a-zA-Z0-9\=\_\-]+)(\/|.html?)?/', '', $text); + $text = preg_replace('/http:\/\/www\.tudou\.com\/(programs\/view|listplay)\/([a-zA-Z0-9=_-]+)(\/|\.html?)?/', '', $text); } } // qq if(strpos($text, 'v.qq.com')){ if(strpos($text, 'vid=')){ - $text = preg_replace('/http:\/\/v.qq.com\/(.+)vid=([a-zA-Z0-9]{8,})/', '', $text); + $text = preg_replace('/http:\/\/v\.qq\.com\/(.+)vid=([a-zA-Z0-9]{8,})/', '', $text); }else{ - $text = preg_replace('/http:\/\/v.qq.com\/(.+)\/([a-zA-Z0-9]{8,}).(html?)/', '', $text); + $text = preg_replace('/http:\/\/v\.qq\.com\/(.+)\/([a-zA-Z0-9]{8,})\.(html?)/', '', $text); } } // gist if(strpos($text, '://gist')){ - $text = preg_replace('/(https?:\/\/gist\.github\.com\/(.+\/)?[\d]+)/', '', $text); + $text = preg_replace('/(https?:\/\/gist\.github\.com\/([a-zA-Z0-9-]+\/)?[\d]+)/', '', $text); } // mentions if(strpos(' '.$text, '@')){