GithubHelp home page GithubHelp logo

beijing_daxuexi_simple's Introduction

北京青年大学习

基于GitHub Action运行,简洁版本

GitHub IP被封啦,只能本地运行了

现在好像GitHub Actions又可以了

在运行时获取最新一集,如未学习进行学习,已学习则结束

建议配置运行频率一周2次(默认为3天一次),没有成功会出错,默认配置下GitHub会向邮箱推送,所以没有推送功能

一些特性:多账号支持,已学习则跳过,自动获取组织ID,验证码识别

How to use

  1. Fork (+ Star)
  2. 填写以下SECRET (名称均为大写)

​ (账号密码为登录青春北京的信息,可以在这里测试登录信息,如何添加SECRET)

​ 方法1:单用户

Name Description
USERNAME 账号(必须)
PASSWORD 密码(必须)

​ 方法2:支持多用户

Name Description
USERNAME 账号信息(必须): 每一行为 账号 密码 中间由空格隔开(由于需要手动权限更新workflow只能用USERNAME这个名字了)

本地运行 -Windows

下载Python,已知3.7-3.9都可以,3.11某些依赖的库不支持。

下载这个repo并解压。

安装依赖: 在解压出来的目录里运行pip install -r requirements.txtpip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple (如果国内环境+没配置代理)

配置账号: main.py 中 accounts = getAccounts() 一行改成 accounts=[('账号1', '密码1'),('账号2', '密码2'),('账号3', '密码3')]形式

运行: 运行main.py

自动运行:可搜索“计划任务”相关,Windows下脚本会自动尝试配置2天一次的计划任务

本地运行 -Linux

# 首次运行建立环境
git clone https://github.com/startkkkkkk/Beijing_Daxuexi_Simple.git
cd Beijing_Daxuexi_Simple
pip install -r requirements.txt

然后新建 run.sh,写入

#!/usr/bin/bash
export USERNAME=你的用户名
export PASSWORD=你的密码
python main.py

添加执行权限 chmod +x run.sh,之后使用 crontab 配置自动运行,执行 crontab -e,在打开的编辑器中写入

0 8 */3 * * /home/username/Beijing_Daxuexi_Simple/run.sh

注意修改以上路径到你自己的路径。

然后重启 cron (sudo service cron restart) 即可。

  1. 在Actions界面手动启用(默认被禁用) Workflows,DaXueXi 自动跟随本分支更新(以希望在有变化时不用再手动fetch upstream),如有安全顾虑或需要修改等可选择没有自动更新的 DaXueXi (No update)
  2. (可以手动运行一次试验),可以在Run python中看到打印的结果信息

beijing_daxuexi_simple's People

Contributors

dependabot[bot] avatar tianzhengs avatar wybxc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

beijing_daxuexi_simple's Issues

登录失败报错

Traceback (most recent call last):
File "/home/zephyr/Beijing_Daxuexi_Simple/study.py", line 22, in study
r'src="(/site/captcha.+)" alt=', touch.text)[0]
IndexError: list index out of range

本地运行出现 Exception: 组织id不匹配

python -u "e:\Beijing_Daxuexi_Simple-main\main.py"
账号数量:1
--User 1--
登录成功
获取组织id-2
无法获取orgID
Traceback (most recent call last):
File "e:\Beijing_Daxuexi_Simple-main\main.py", line 66, in
if study(username, password, ua):
File "e:\Beijing_Daxuexi_Simple-main\study.py", line 101, in study
raise Exception('组织id不匹配,如果看到这个请开个issue说下')
Exception: 组织id不匹配,如果看到这个请开个issue说下

最近一次的程序运行报错

在Actions中的Job部分:
在显示User1登录成功后便开始报错。具体的Python报错是在request中的get报错
在Summary中的Annotation中显示为build报错:
Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: actions/checkout, aormsby/Fork-Sync-With-Upstream-action, actions/setup-python, actions/checkout
因为之前就已经Fork+Star了,并且在自己的Action中运行成功多次了,突然报错有点不知所措,不知道是什么问题。

出现报错

Traceback (most recent call last):
33
File "main.py", line 51, in
34
Error: raise Exception('貌似自己这显示完成了,但实际上没有?建议自己检查下(尤其是有团支书账号可以看到情况的),然后可以在issue#31里反馈下')
35
Exception: 貌似自己这显示完成了,但实际上没有?建议自己检查下(尤其是有团支书账号可以看到情况的),然后可以在issue#31里反馈下

今天更新大学习后运行报错

--User 1--
� 登录成功
完成青年大学习:坚强核心(团员和青年主题教育特辑), 但未在检查中确认
--Summary--
成功:0,失败:1
Traceback (most recent call last):
  File "main.py", line 73, in <module>
    raise Exception(f'有{failed}个失败!')
Exception: 有1个失败!

action 运行失败

actions/checkout@v2, aormsby/[email protected], and actions/setup-python@v1 are not allowed to be used in surreyskahn/Beijing_Daxuexi_Simple. Actions in this workflow must be: within a repository owned by surreyskahn.

Exception: 组织id不匹配

登录成功
获取组织id-2
无法获取orgID
Traceback (most recent call last):
File "D:\ShareCache\Office-PKU\团支书工作\Beijing_Daxuexi_Simple-main\main.py", line 51, in
if study(username, password, ua):
File "D:\ShareCache\Office-PKU\团支书工作\Beijing_Daxuexi_Simple-main\study.py", line 101, in study
raise Exception('组织id不匹配,如果看到这个请开个issue说下')
Exception: 组织id不匹配,如果看到这个请开个issue说下

> 请问补上速通链接已点过的期数的具体方法

    > 我这里还是不行

刚刚试了,显示Error: raise Exception('貌似自己这显示完成了,但实际上没有?建议自己检查下(尤其是有团支书账号可以看到情况的),然后可以在issue#31里反馈下') 团支书后台没有记录

我这里刚刚试过,还是没有显示,我在想是不是因为之前我点过那个速通链接,多点了很多导致留下了不少空白的完成记录。但现在速通链接已经寄了,所以即使后台看不到完成记录,但在这里还是检测为已完成,所以就没有速通?是不是要等到空白记录都填上,这个程序才能发挥作用?

新的期数应该可以,以前的应该是这个情况,如果不想手动解决可以把文件主体那块换成一个循环补下以前的

Originally posted by @startkkkkkk in #31 (comment)

 小白请问您在这里说的“补下以前的”具体怎么操作呢,我试图直接修改study.py, 不再检查是否已经做过(直接注释Line80-82 QWQ我只是试试,不知道怎么改),然后就出现以下报错信息

Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/urllib3/connection.py", line 175, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

KeyError: 'newCourse'

想问一下大佬这个问题应该怎么解决?
Traceback (most recent call last):
账号数量:1
File "main.py", line 49, in
--User 1--
raise Exception(f'有{failed}个失败!')
登录成功
Exception: 有1个失败!
{'message': '请登录', 'code': 0}
Traceback (most recent call last):
File "/home/runner/work/Beijing_Daxuexi_Simple/Beijing_Daxuexi_Simple/study.py", line 43, in study
url = r['newCourse']['url']
KeyError: 'newCourse'

总是运行失败

按要求多个账号提示未加入secret,secret改为只用单个账号能登录但是爆出服务器内部错误,请问该咋办呀

本地运行出现 Exception: 组织id不匹配

python -u "e:\Beijing_Daxuexi_Simple-main\main.py"
账号数量:1
--User 1--
登录成功
获取组织id-2
无法获取orgID
Traceback (most recent call last):
File "e:\Beijing_Daxuexi_Simple-main\main.py", line 66, in
if study(username, password, ua):
File "e:\Beijing_Daxuexi_Simple-main\study.py", line 101, in study
raise Exception('组织id不匹配,如果看到这个请开个issue说下')
Exception: 组织id不匹配,如果看到这个请开个issue说下

Error occurred while the Web server was processing your request

多用户下,除“在运行前已完成,退出”的User外,均出现“服务器内部错误。”

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,target-densitydpi=high-dpi,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="robots" content="noarchive">
     <meta name="csrf-param" content="_csrf_mobile">
<meta name="csrf-token" content="fDy1EivNA8MJ1q1W_fBRUhoAYNHmn6-1DFiODQm4Y9tLX_x2Qq8wjkex_zeXqGFrT2IhtJf0yNtvEed5ffoPqA==">
    <title>错误 (#8)</title>
    <link href="/css/css.css" rel="stylesheet">
<link href="/css/icons-extra.css" rel="stylesheet">
<script src="/js/mui.min.js"></script>
<script src="/js/mui.zoom.js"></script>
<script src="/js/mui.previewimage.js"></script>
<script src="/js/jquery.min.js"></script> 
</head>

<body>
<div class="site-error">

    <h1>错误 (#8)</h1>

    <div class="alert alert-danger">
        服务器内部错误。    </div>

    <p>
        The above error occurred while the Web server was processing your request.
    </p>
    <p>
        Please contact us if you think this is a server error. Thank you.
    </p>

</div>


<script type="text/javascript" charset="utf-8">//mui('.mui-scroll-wrapper').scroll({
// 	deceleration: 0.0005, //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006,
// 	scrollY: true, //是否竖向滚动
// 	scrollX: false, //是否横向滚动
// 	indicators: false, //是否显示滚动条
// // 	parallaxElement: "#refreshContainer1",
// // 	parallaxRatio: 0.4,
// // 	drag: function() {
// // 		alert("a");
// // 	}

//});
</script>
</body>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?f68c037bb28394495cc1502351e9cebd";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
<!-- <script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
<script>LA.init({id: "JWNuO3ul2n4LyYbV",ck: "JWNuO3ul2n4LyYbV"})</script> -->

学习频率设置

请问一下如果我想改成两天学习一次应该在哪个文件中更改呢?

Docker运行的多账号密码格式怎么写

docker中一人一个容器没问题
但一个容器多个账号就提示报错了
我试的格式是:配置账号:USERNAME=[('账号1', '密码1'),('账号2', '密码2'),('账号3', '密码3')]
请问应该如何修改呢?

不能自动填充验证码

你好,测试登陆青春北京时,用户名和密码可以自动填写,验证码却不能,导致手动action时报错失败。想问一下问题出在哪里。谢谢

关于青年大学习账号和密码

我在微信青春山东公众号上进行青年大学习,自动使用微信登录,没有设置过账号和密码,我应该在哪里设置账户和密码?

等个更新

--User 1--
Traceback (most recent call last):
File "C:\Users\LMY\Desktop\Daxuexi\study.py", line 25, in study
capText = cap_recognize(bjySession.get(url=capUrl).content)
File "C:\Users\LMY\Desktop\Daxuexi\utility.py", line 27, in cap_recognize
return DdddOcr().classification(denoise(cap))
File "C:\Users\LMY\Desktop\Daxuexi\utility.py", line 31, in denoise
img = Image.open(BytesIO(cap))
File "c:\Users\LMY\Desktop\Daxuexi\venv38\lib\site-packages\PIL\Image.py", line 3280, in open
raise UnidentifiedImageError(msg)
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001F6FFEA5F40>

Traceback (most recent call last):
File "C:\Users\LMY\Desktop\Daxuexi\study.py", line 21, in study
capUrl = "https://m.bjyouth.net" + re.findall(
IndexError: list index out of range

Login:识别的验证码错误
Traceback (most recent call last):
File "C:\Users\LMY\Desktop\Daxuexi\study.py", line 21, in study
capUrl = "https://m.bjyouth.net" + re.findall(
IndexError: list index out of range

登录成功
Traceback (most recent call last):
File "C:\Users\LMY\Desktop\Daxuexi\study.py", line 42, in study
r = json.loads(bjySession.get("https://m.bjyouth.net/dxx/index").text)
File "C:\Users\LMY\AppData\Local\Programs\Python\Python38\lib\json_init_.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\Users\LMY\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\LMY\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

登入失败,退出

1月3日本地运行出现异常,登录后返回以下代码,请大佬们帮忙看看是什么问题,感谢!

Traceback (most recent call last):
File "D:\python\py\lib\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "D:\python\py\lib\json_init_.py", line 348, in loads
return _default_decoder.decode(s)
File "D:\python\py\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\python\py\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\python\Beijing_Daxuexi_Simple-main\main.py", line 43, in
if study(username, password, ua):
File "D:\python\Beijing_Daxuexi_Simple-main\study.py", line 62, in study
haveLearned = bjySession.get(learnedInfo).json()
File "D:\python\py\lib\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 2 column 1 (char 2)

api 疑似失效

我之前是靠类似本仓库的方法,手动点击链接完成学习的,并在国庆期间预学习了本周内容。今天准备预学习下周内容,发现链接失效,然后找到了这个仓库。非常感谢作者为我们做的这些,但我发现了两个疑似无法修复的问题:

1、之前是可以预学习的,比如9月就可以把91期92期都学完;但是今天我把本仓库在本地跑了跑,发现无论如何都无法预学习未来的内容,总是会返回本期内容。

2、更重要的是,使用这类方法,我自己可以查到自己完成了学习,但团支书那边显示我没有。因为我自己之前就有了学习记录,所以无法复现这个问题。我怀疑这个方法已经失效了。

希望其他人尤其是团支书确认一下是否存在这些问题,及时补票,避免大家超过学习时限。

学习相关问题

你好,想请教下学习方法,我刚刚入门会使用基本语法,但感觉缺乏很多系统性知识 想请教下如何学习。比如说让自己的代码能在actions运行,pycharm生成requirements.txt等功能之前都不知道。看了你编程的大为震撼,请指教!

可能是封了外网ip

账号数量:1
--User 1--
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/urllib3/connection.py", line 175, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='m.bjyouth.net', port=443): Max retries exceeded with url: /site/login (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fa144955d90>: Failed to establish a new connection: [Errno 110] Connection timed out'))
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='m.bjyouth.net', port=443): Max retries exceeded with url: /site/login (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fa1446cf090>: Failed to establish a new connection: [Errno 110] Connection timed out'))

error: code 128

image
我已经把代码在本地运行了一遍,学习记录里也显示成功了,但是在Actions里就会这样报错是为什么呢

Json解析报错

本周开始study.py中的haveLearned = bjySession.get(learnedInfo).json()运行报错,看起来像Json Decoder的问题,报错信息如下:

账号数量:2
--User 1--
登录成功
Traceback (most recent call last):
  File "C:\Users\PathfinderZ\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\PathfinderZ\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\PathfinderZ\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\PathfinderZ\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\01.Code\Beijing_Daxuexi_Simple-main\main.py", line 70, in <module>
    if study(username, password, ua):
  File "D:\01.Code\Beijing_Daxuexi_Simple-main\study.py", line 62, in study
    haveLearned = bjySession.get(learnedInfo).json()
  File "C:\Users\PathfinderZ\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 2 column 1 (char 2)

关于github action的政策问题

根据github的有关规定,像这种利用action跑脚本的行为是违规的,有很多人的仓库都被封了,但似乎每两个月给你发邮件提醒的时候重新启动action可以避免被封。
所以想请问一下大佬,有没有兴趣做一个本地运行或者云函数的版本,这样可以避免未来发生问题

#24 修复之后任然报错

#24 为两小时前关闭的ISSUE,但是新运行的ACTION仍然报错。

6小时前,约10月10日8点自动运行失败,刚刚手动运行也失败
注意到Fork中的Code中最近更新在3小时以前(约12点)

  • --User 1--
    登录成功
    Traceback (most recent call last):
    File "main.py", line 42, in
    if study(username, password, ua):
    File "/home/runner/work/Beijing_Daxuexi_Simple/Beijing_Daxuexi_Simple/study.py", line 95, in study
    haveLearned = json.loads(r.text)
    File "/opt/hostedtoolcache/Python/3.7.14/x64/lib/python3.7/json/init.py", line 348, in loads
    return _default_decoder.decode(s)
    File "/opt/hostedtoolcache/Python/3.7.14/x64/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/opt/hostedtoolcache/Python/3.7.14/x64/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 2)
    Error: Process completed with exit code 1.

本地运行出现 Exception: 组织id不匹配

python -u "e:\Beijing_Daxuexi_Simple-main\main.py"
账号数量:1
--User 1--
登录成功
获取组织id-2
无法获取orgID
Traceback (most recent call last):
File "e:\Beijing_Daxuexi_Simple-main\main.py", line 66, in
if study(username, password, ua):
File "e:\Beijing_Daxuexi_Simple-main\study.py", line 101, in study
raise Exception('组织id不匹配,如果看到这个请开个issue说下')
Exception: 组织id不匹配,如果看到这个请开个issue说下

无法使用

请问有仍使用github的方案吗?毕竟比本地方便...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.