青书学堂 看视频 耍课时

1. 获取课程节点id

( /nynzy/Student/Course/GetStudyRecordAndScore ) 接口地址

2. 把所有的nodeId 保存下来 保存到 old.txt

格式 课程id 与 nodeId 用 | 隔开

3. 然后创建 test.php

注意把 cookie 换成自己的

<?php


$oldFilename = './old.txt';
$newFilename = './new.txt';

$oldData = file_get_contents($oldFilename);
$oldData = explode("\r\n", $oldData);
$newData = [];
foreach ($oldData as $key => $value) {
   if (empty($value)) {
      continue;
   }
   $tmp = explode('|', $value);
   $courseId = $tmp[0];
   $contentId = $tmp[1];
   echo PHP_EOL. $courseId . ' ' . $contentId;
   $beginId = begin($courseId, $contentId);
   $newData[] = [$courseId, $contentId, $beginId];
   $str = $courseId . '|' . $contentId . '|' . $beginId . PHP_EOL;
   file_put_contents($newFilename, $str, FILE_APPEND);
   refresh($beginId,$courseId, $contentId);

}
$i = 360;
while ($i > 0) {
   $i --;
   echo '还剩 ' . $i . ' 次刷新' . PHP_EOL;
   foreach ($newData as $key => $value) {
      refresh($value[2],$value[0], $value[1]);
   }
   sleep(10);
}
echo '结束';


function begin($courseId, $contentId)
{

   $curl = curl_init();
   curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://degree.qingshuxuetang.com/nynzy/Student/Course/UploadStudyRecordBegin?_t=' . (time() * 1000),
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_POSTFIELDS => '{
      "classId": "34",
      "courseId": "' . $courseId . '",
      "contentId": "' . $contentId . '",
      "contentType": 11,
      "periodId": "21",
      "position": 0,
      "detectId": null
   }',
      CURLOPT_HTTPHEADER => array(
         'Accept: application/json',
         'Accept-Language: zh-CN,zh;q=0.9',
         'Connection: keep-alive',
         'Device-Trace-Id-QS: 027d06da-4bd6-4817-8c7e-28fd518162dd',
         'Origin: https://degree.qingshuxuetang.com',
         "Referer: https://degree.qingshuxuetang.com/nynzy/Student/Course/CourseShow?teachPlanId=34&periodId=21&courseId=$courseId&nodeId=$contentId",
         'Cookie: AccessToken=换成自己的; __environment=production',
         'User-Agent: Apifox/1.0.0 (https://apifox.com)',
         'Content-Type: application/json',
         'Host: degree.qingshuxuetang.com'
      ),
   ));

   $response = curl_exec($curl);
   echo 'begin 请求结果:' . $response . PHP_EOL;
   curl_close($curl);
   $response = json_decode($response, true);
   if ($response['message'] == '成功') {
      return $response['data'];
   } else {
      dd($response);
   }
}
function dd($data)
{
   print_r($data);
   die();
}

function refresh($id,$courseId, $contentId)
{

   $curl = curl_init();

   curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://degree.qingshuxuetang.com/nynzy/Student/Course/UploadStudyRecordContinue?_t=' . (time() * 1000),
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_POSTFIELDS => array('recordId' => $id, 'end' => 'true', 'position' => '3000', 'timeOutConfirm' => 'false'),
      CURLOPT_HTTPHEADER => array(
         'Accept: application/json',
         'Accept-Language: zh-CN,zh;q=0.9',
         'Connection: keep-alive',
         'Cookie: AccessToken=换成自己的; __environment=production',
         'Device-Trace-Id-QS: 027d06da-4bd6-4817-8c7e-28fd518162dd',
         'Origin: https://degree.qingshuxuetang.com',
         "Referer: https://degree.qingshuxuetang.com/nynzy/Student/Course/CourseShow?teachPlanId=34&periodId=21&courseId=$courseId&nodeId=$contentId",
         'Sec-Fetch-Dest: empty',
         'Sec-Fetch-Mode: cors',
         'Sec-Fetch-Site: same-origin',
         'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0',
         'X-Requested-With: XMLHttpRequest',
         'sec-ch-ua: "Chromium";v="122", "Not(A:Brand";v="24", "Microsoft Edge";v="122"',
         'sec-ch-ua-mobile: ?0',
         'sec-ch-ua-platform: "Windows"'
      ),
   ));

   $response = curl_exec($curl);
   // dd(curl_errno($curl));
   echo 'refresh 请求结果:' . $response . PHP_EOL;
   curl_close($curl);
   $response = json_decode($response, true);
   if ($response['message'] == '成功') {
      return true;
   } else {
      echo '响应错误';
      // dd($response);
   }
}
4. 运行 test.php

定时是1小时 1小时过后 把这一个课程的所有 章节就看完了

省了特别多的时间

相关推荐
Ai 编码助手15 分钟前
使用php和Xunsearch提升音乐网站的歌曲搜索效果
开发语言·php
简鹿办公35 分钟前
如何提取某站 MV 视频中的音乐为 MP3 音频
音视频·简鹿视频格式转换器·视频提取mp3音频
yufengxinpian41 分钟前
集成了高性能ARM Cortex-M0+处理器的一款SimpleLink 2.4 GHz无线模块-RF-BM-2340B1
单片机·嵌入式硬件·音视频·智能硬件
wkj0012 小时前
php操作redis
开发语言·redis·php
runing_an_min2 小时前
ffmpeg视频滤镜:替换部分帧-freezeframes
ffmpeg·音视频·freezeframes
runing_an_min5 小时前
ffmpeg视频滤镜:提取缩略图-framestep
ffmpeg·音视频·framestep
小曲曲5 小时前
接口上传视频和oss直传视频到阿里云组件
javascript·阿里云·音视频
安静读书8 小时前
Python解析视频FPS(帧率)、分辨率信息
python·opencv·音视频
佑华硬盘拷贝机8 小时前
音频档案批量拷贝:专业SD拷贝机解决方案
音视频
EasyNVR8 小时前
NVR管理平台EasyNVR多个NVR同时管理:全方位安防监控视频融合云平台方案
安全·音视频·监控·视频监控