Skip to content

Commit 25f5f86

Browse files
authored
Merge pull request #18 from xyuanmu/patch-1
[1.2.5] 更新链接正则
2 parents 801f8c4 + ce026b0 commit 25f5f86

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Action.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ private function shortcode(){
3838
}
3939
elseif(strpos($url,'xiami.com')!==false){
4040
$server='xiami';
41-
if(preg_match('/collect\/([^\.]*)/i',$url,$id))list($id,$type)=array($id[1],'playlist');
42-
elseif(preg_match('/album\/([^\.]*)/i',$url,$id))list($id,$type)=array($id[1],'album');
43-
elseif(preg_match('/song\/([^\.]*)/i',$url,$id))list($id,$type)=array($id[1],'song');
44-
elseif(preg_match('/artist\/([^\.]*)/i',$url,$id))list($id,$type)=array($id[1],'artist');
41+
if(preg_match('/collect\/(\w+)/i',$url,$id))list($id,$type)=array($id[1],'playlist');
42+
elseif(preg_match('/album\/(\w+)/i',$url,$id))list($id,$type)=array($id[1],'album');
43+
elseif(preg_match('/[\/.]\w+\/[songdem]+\/(\w+)/i',$url,$id))list($id,$type)=array($id[1],'song');
44+
elseif(preg_match('/artist\/(\w+)/i',$url,$id))list($id,$type)=array($id[1],'artist');
4545
if(!preg_match('/^\d*$/i',$id,$t)){
4646
$data=self::curl($url);
4747
preg_match('/'.$type.'\/(\d+)/i',$data,$id);
@@ -51,8 +51,9 @@ private function shortcode(){
5151
elseif(strpos($url,'kugou.com')!==false){
5252
$server='kugou';
5353
if(preg_match('/special\/single\/(\d+)/i',$url,$id))list($id,$type)=array($id[1],'playlist');
54-
elseif(preg_match('/album\/single\/(\d+)/i',$url,$id))list($id,$type)=array($id[1],'album');
55-
elseif(preg_match('/singer\/home\/(\d+)/i',$url,$id))list($id,$type)=array($id[1],'artist');
54+
elseif(preg_match('/song\/#hash\=(\w+)/i',$url,$id))list($id,$type)=array($id[1],'song');
55+
elseif(preg_match('/album\/[single\/]*(\d+)/i',$url,$id))list($id,$type)=array($id[1],'album');
56+
elseif(preg_match('/singer\/[home\/]*(\d+)/i',$url,$id))list($id,$type)=array($id[1],'artist');
5657
}
5758
elseif(strpos($url,'baidu.com')!==false){
5859
$server='baidu';

0 commit comments

Comments
 (0)