1 Star 0 Fork 5

cc/vms

forked from wmenjoy/vms 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
parseSrcInfo.sh 2.49 KB
一键复制 编辑 原始数据 按行查看 历史
liujinliang 提交于 2021-12-20 19:22 . 增加修改
#!/bin/bash
parseDetail(){
url=$1
title=$2
listFile=$3
group=$4
page=$(curl $url 2>/dev/null|grep "\<a "|grep "DownSys"|sed 's/ /^|^/g')
for detail in $page;
do
playUrl=$(echo "$detail"|awk -F '"' '{print $2}')
playType=$(echo "$detail"|awk -F '>|<' '{print $3}')
videoUrl=$(curl $playUrl 2>/dev/null|grep iframe|awk -F 'src="' '{print $2}'|awk -F'"' '{print $1}')
if [ ! -z "$videoUrl" ]; then
curl $videoUrl 2>/dev/null 1>/dev/null
if [ "$?" == "0" ]; then
realBaseUrl=${videoUrl%/share/*}
m3u8File=$(curl $videoUrl 2>/dev/null|grep playlist |grep url|awk -F '"' '{print $4}')
if [ ! -z "$m3u8File" ]; then
echo $group,$title $playType,$realBaseUrl$m3u8File"?skipl=1"|sed 's/ //g' >> $listFile
else
echo "$videoUrl 没找到m3u8"
fi
else
echo "$videoUrl 访问不通"
fi
else
m3u8File=$(curl $playUrl 2>/dev/null|grep video=|awk -F '->' '{print $1}'|awk -F"'" '{print $2}')
if [ ! -z "$m3u8File" ]; then
curl $m3u8File 2>/dev/null 1>/dev/null
if [ "$?" == "0" ]; then
echo $group,$title $playType,$m3u8File"?skipl=1" >> $listFile
else
echo "$m3u8File 访问不通"
fi
fi
fi
done
}
outPageDetail(){
baseUrl=$1
listFile=$2
extractFile=$3
group=$4
prefix=$baseUrl"/"
postfix=".html"
baseInfos=$(curl $baseUrl/$extractFile 2>/dev/null | grep "<a "|grep title|grep class=|grep "bookmark"|awk '{print $2"^|^"$5}')
for baseInfo in $baseInfos
do
title=$(echo $baseInfo|awk -F'"' '{print $4}')
[ -z "$title" ] && echo "title为空==>"$baseInfo
url=$(echo $baseInfo |awk -F'"' '{print $2}')
len=$(( ${#url}-${#postfix}-${#prefix} + 1 ))
id=${url:$((${#prefix} - 1 )):$len}
echo "开始-->$title:$url"
parseDetail $url $title $listFile $group
done
}
getPageList() {
baseUrl=$1
listFile=$2
end=$3
group=$4
echo "抓取$baseUrl/index.html"
outPageDetail $baseUrl $listFile "index.html" $group
for i in `seq 2 $end`;
do
echo "抓取$baseUrl/index_$i.html"
outPageDetail $baseUrl $listFile "index_$i.html" $group
done
}
#getPageList https://www.ai66.cc/kehuanpian/ ai66/kehuan.txt 38
#getPageList https://www.ai66.cc/xijupian/ ai66/xijupian.txt 92
getPageList https://www.ai66.cc/$1/ ai66/$1.txt $2 $3
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cjcv/vms.git
git@gitee.com:cjcv/vms.git
cjcv
vms
vms
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385