排行榜 统计
  • 文章总数:7 篇
  • 评论总数:1 条
  • 分类总数:1 个
  • 最后更新:2022年12月16日

恋听网有声小说采集PHP源码

本文阅读 1 分钟
首页 默认分类 正文

20221120125814110-1600x1100.jpg

恋听网有声小说采集PHP源码,网站采集有限制,具体限制策略未知。如果采集失败请更换设备或IP,

<?php 
$bookid = 4206;
//恋听网小说ID
$bookname = "网游之天谴修罗";
//保存本地文件夹名
$bookstart  =390;
//开始章节
$bookall  = 445;
//总共章节
for ($i=$bookstart; $i<=$bookall; $i++) {
  $data = json_decode(posturl($i,$bookid),true);
  $name="第" .$i. "章" .urldecode($data["title"]);
  $mp3url = $data["url"];
  if($mp3url == "") {
    $i = $i-1;
  } else {
    file_put_contents(dirname(__FILE__) ."/".$bookname."/". $name . ".mp3",file_get_contents($mp3url));
  }
}
function posturl($page,$bookid) {
  $url = "https://m.ting55.com/glink";
  //$data  = json_encode($data);    
  $headerArray =array(
          'POST /glink HTTP/1.1
Host: m.ting55.com
Connection: keep-alive
Content-Length: 28
sec-ch-ua: "Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"
sec-ch-ua-mobile: ?1
User-Agent: Mozilla/5.0 (Linux; Android 11; M2102J2SC) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.9.0 Mobile Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
xt: 77d02c0bf453b5ec8f5b8a0c34125c17
sec-ch-ua-platform: "Android"
Origin: https://m.ting55.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://m.ting55.com/book/4206-390
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: __bid_n=18476c8e3a542905314207; FPTOKEN=30$wKXbo8SfsrG2v2NNrNXPmfiVB/NPEVU43trUJmg240mRtjWjkj5W96sjoOdSuIUPvxHe4m6IzsPt15mOgsZGV/xjI1eeC/6pIC1J19/KnxEmqbVRP7YrrXdfO26WlzdLjKcLfwphLdmsKszGyV6gBvaQlUoyvrUsxcsy0uUIbQb5MqM9LAFej27zuqkWplWcjyLVuZ80Dx/Yfu2lcCuOr4lTDWarq6jkpJ4Txn/SAw0ws8EzsowSsuV51vmGCgluOCxJuIYkBaB3LyCAWuW5xroCAkgvrwAGrtgL9Z6yJsFCMJqgyO1GRoXNwAFZuS2GBku6Dab3bZJMl3AgHA+QORVVn/rvtupsJDUZEPRw5Ki4VOF0yNVQlcIa28ZVn/FCUDyJUoRWrwPSyJIq1kdUDe8SBtObmXLTRYAhf+kl49k=|FqEJnWvQKBusm4ayF8tig4oI0RcFy3BVBTNYzugNrz4=|10|945b00b47c2d6933ac07709d99ef5884; mhting55=9e7f3ecb52c17f41; __gads=ID=b0f3e0922533a032-2288af215bd80057:T=1668474587:RT=1668474587:S=ALNI_MbyyRzmT8adXeAcpdQpjxTvw7NSAQ; t55hm=1; __gpi=UID=00000b7c20234aca:T=1668474587:RT=1668745774:S=ALNI_MYBpVA4F0Nu9NnEZQ09Tta--nTfTg; JSESSIONID=9E9EF42E74B87F050280B30BFF7E8B4B
page='.$page.'&bookId='.$bookid.'&isPay=0'
          );
  //print_r($headerArray);
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
  curl_setopt($curl, CURLOPT_POST, 1);
  // curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
  curl_setopt($curl,CURLOPT_HTTPHEADER,$headerArray);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  $output = curl_exec($curl);
  curl_close($curl);
  return $output;
}
本文经授权后发布,本文观点不代表立场,文章出自:https://www.uhmao.com/706.html
-- 展开阅读全文 --
懒人听书部分API
« 上一篇 11-21

发表评论

发表评论

作者信息

RuaMao
作者有点忙,还没写简介
TA的最新作品

动态快讯

    请配置好页面缩略名选项

热门文章

标签TAG

热评文章