采集X站,仅提供学习
<?php /** * curl 获取网页源码函数 * @param $url 目标页面 URL * @return 页面源码 */ function curl($url){ $ch = curl_init(); $timeout = 30; $ua = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_ENCODING, ""); curl_setopt($ch, CURLOPT_USERAGENT, $ua); // 伪造ua curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); // 取消gzip压缩 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // https请求 不验证证书和hosts curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); $content = trim(curl_exec($ch)); curl_close($ch); return $content; } header('Content-type: text/html; charset=utf-8'); $content = curl('https://zy2.pu1.pw:8811'); preg_match_all('/<img onerror="(.*)" width="200" height="135" src="(.*)" alt="(.*)"\/>/sU', $content, $imgsrc); preg_match_all('/<span class="video-title">(.*)<\/span><div class="video-details">/sU', $content, $title); echo ' <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>采集x站</title> <style> body{list-style-type: none;margin: 0;padding: 0;} .container{width: 100%;} .row{} .col-md-12{width:100%} .col-md-12{float: left;} .col-md-12,.col-sm-12,{position: relative;min-height: 1px;padding-right: 15px;padding-left: 15px;} .content, .panel, .breadcrumb{border:none !important;-webkit-background-clip: padding-box;-moz-background-clip: padding-box;background-clip: padding-box;} .panel{margin-bottom: 5px;} .panel{margin-bottom:20px;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)} .panel-watched{max-height: none;} .panel-body{box-radius: 0 0 5px 5px;} .panel-padding{padding: 10px 5px;} .videos{list-style-type: none;} .videos li{width: 202px;margin: 0 6px 0 6px;display: inline-block;list-style-type: none;margin: 0;padding: 0;} .albums li, .photos li, .models li, .channels li, .playlists li{float: left;width: 90%;height: auto;margin: 0 4px 0 4px;} .video, .user, .category, .album, .photo, .model, .channel, .playlist{position: relative;} .video a, .user a, .category a, .album a, .photo a, .model a, .channel a, .playlist a{text-decoration: none;} .thumbnail{background: #1d1d1d;box-shadow: none;background-image: none;border: none;border-radius: 0;padding: 0;padding-bottom: 5px;} .jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out} a{color: #d8d8d8;} a:hover{color:#fff;} .video-thumb{position: relative;overflow: hidden;} ul.videos li a div.video-thumb img{width: 202px;height: 136px;} .video-title{width: 95%;} .video-title{color: #ff1e2b;} .video-title, .playlist-title{width: 94%;padding: 0 3%;overflow: hidden;height: 18px;line-height: 130%;text-align: left;margin: 4px 0;display: block;} </style> </head> <body> <div class="container"> <div class="row"> <div class="col-xs col-sm-12 col-md-12"> <div class="panel panel-default"> <div class="panel-body panel-padding panel-watched"> <ul class="videos videosf"> '; for ($i=0; $i< 49; $i++) { //取图片链接 preg_match('/src="(.*)"/U', $imgsrc[0][$i], $img); $video['img'] = $img[1]; //取影片名称 preg_match('/video-title">(.*)<\/span>/U', $title[0][$i], $name); $video['name'] = $name[1]; //取影片链接 $url = str_replace("1.jpg","index.m3u8",$video['img']); $video['url'] = $url; echo ' <li> <div class="video"> <a href="https://api.mw0.xyz/jx/m3u8.php?url='.$video['url'].'" title="" target="_blank" class="thumbnail"> <div class="video-thumb"> <img width="200" height="135" src="'.$video['img'].'" alt=""> </div> <span class="video-title">'.$video['name'].'</span> </a> </div> </li> '; } echo ' </ul> </div> </div> </div> </div> </div> </body> </html> '; ?>
该附件已被管理员隐藏 您需要回复后并刷新才可以下载
如果你觉得雨滴资源网对你有帮助的话,可以小小的打赏一下小站,用于维持本站的运营!
版权声明:雨滴资源网内容来源于互联网,如果有侵权内容、不妥之处,请第一时间联系我们删除。敬请谅解!
本文链接:采集X站,仅提供学习 - https://www.yudzy.com/68.html
失效提示:此文更新于2018-7-17,如果文章内容或图片资源失效,请留言反馈,客服会及时处理,谢谢!
评论
2条评论夏午 Lv.1 Internet Explorer iPhone iOS 12.1.4 回复
老劳模
福建省厦门市 联通
王建民 Lv.1 Chrome 63.0.3239.132 Windows 7 回复
看看卡
广东省佛山市 电信