青书学堂 看视频 耍课时

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小时过后 把这一个课程的所有 章节就看完了

省了特别多的时间

相关推荐
龙哥·三年风水9 小时前
群控系统服务端开发模式-应用开发-个人资料
分布式·php·群控系统
我喜欢就喜欢11 小时前
基于qt vs下的视频播放
开发语言·qt·音视频
安步当歌12 小时前
【WebRTC】视频采集模块中各个类的简单分析
音视频·webrtc·视频编解码·video-codec
EasyGBS13 小时前
国标GB28181公网直播EasyGBS国标GB28181软件管理解决方案
大数据·网络·音视频·媒体·视频监控·gb28181
Dingww101113 小时前
梧桐数据库中的网络地址类型使用介绍分享
数据库·oracle·php
Johnstons15 小时前
AnaTraf | 网络性能监控系统保障音视频质量的秘籍
网络·音视频·网络流量监控·网络流量分析·npmd
lrlianmengba15 小时前
推荐一款非常好用的视频编辑软件:Movavi Video Editor Plus
音视频
SZ17011023115 小时前
ffplay 实现视频流中音频的延迟
音视频·延迟
Genius Kim17 小时前
SpringCloud Sentinel 服务治理详解
spring cloud·sentinel·php
LNTON羚通17 小时前
CPU算法分析LiteAIServer视频智能分析平台视频智能分析:抖动、过亮与过暗检测技术
大数据·目标检测·音视频·视频监控