Comments (4)
请在文件cxapi/jobs/video.py
的71行html = BeautifulSoup(resp.text, 'lxml')
下方添加print(html)
输出card页的html源码检查内嵌js代码是否存在对window.AttachmentSetting
的赋值语句
from cxkitty.
我的一个课开始的部分章节没有开放,出现了相同的错误。页面源码为:
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<meta content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
name="viewport"/>
<title> 信息提示</title>
<link href="/css/tip.css?v=1.0.3" rel="stylesheet"/>
<script src="/static/js/domain.js" type="text/javascript"></script>
<script src="/js/phone/protocolChaoXing/CXJSBridge.js"></script>
</script>
</head>
<body>
<div class="ybox">
<p class="blankTips">章节未开放!</p>
</div>
</body>
</html>
from cxkitty.
为了刷课自己hack了一个能运行的,估计没什么参考价值
diff --git a/cxapi/jobs/video.py b/cxapi/jobs/video.py
index fbc8675..75f0804 100644
--- a/cxapi/jobs/video.py
+++ b/cxapi/jobs/video.py
@@ -86,6 +86,11 @@ class ChapterVideo:
resp.raise_for_status()
html = BeautifulSoup(resp.text, "lxml")
try:
+ try:
+ if 'blankTips' in html.p['class']:
+ return False
+ except Exception:
+ pass
if r := re.search(
r"window\.AttachmentSetting *= *(.+?);",
html.head.find("script", type="text/javascript").text,
from cxkitty.
为了刷课自己hack了一个能运行的,估计没什么参考价值
diff --git a/cxapi/jobs/video.py b/cxapi/jobs/video.py index fbc8675..75f0804 100644 --- a/cxapi/jobs/video.py +++ b/cxapi/jobs/video.py @@ -86,6 +86,11 @@ class ChapterVideo: resp.raise_for_status() html = BeautifulSoup(resp.text, "lxml") try: + try: + if 'blankTips' in html.p['class']: + return False + except Exception: + pass if r := re.search( r"window\.AttachmentSetting *= *(.+?);", html.head.find("script", type="text/javascript").text,
大佬 这个要加在哪里呢
from cxkitty.
Related Issues (20)
- 请问如何实现一次选多个科目或一个科目结束后返回选另一个科目而不是直接退出 HOT 1
- 怎么让没有匹配到答案的题随机选一个答案提交
- RuntimeError: 视频预拉取出错 HOT 7
- 上报时出错 HOT 2
- RuntimeError: 视频预拉取出错 HOT 1
- 出现以下报错:RuntimeError: 视频预拉取出错 以下是log日志文件 HOT 3
- 获取课程信息失败,没有core字段了
- AttributeError:“NoneType”对象没有属性“text” ,用API在线题库,显示jsonpath没有compile方法 HOT 4
- 安装时出错 HOT 1
- 账号密码登录没有反应 HOT 1
- 刷课途中闪退 HOT 1
- AttributeError: 'NoneType' object has no attribute 'text' HOT 2
- 可以添加一个匹配不到题目随机选择并提交 HOT 1
- 为啥安装上lxml之后也老是报错,我用poetry命令安装4.9.1安装不上,转而又安装4.9.2就报错 HOT 2
- 下载完这个最新版本的之后,观看完视频直接报错 HOT 2
- 这报错太快了 截图好费劲。 HOT 1
- 这个项目是不是不支持python 3.11.3? HOT 1
- 运行主程序时打开立马闪退 HOT 5
- enncy的题库到底要怎么设置啊只需要token不行啊 HOT 1
- 提问 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cxkitty.