MENU

懒是对高效率的向往

April 17, 2020 • 有生之年

这篇文章还是关于ccmtv的。日常欺负厂家,日常不务正业。

不知因为是我太懒,还是因为我不够勤奋,看着网页上3个一组的签到任务,也懒得点。

于是就写了下面的ccmtv网课一键签到工具。用python写的,最初需要修改用户名和密码变量使用。估计不是每个小伙伴电脑里都装了python的=_=。考虑到运行python也比较麻烦,就打包成exe文件了,双击可直接运行。

第一次运行需按说明输入用户名和密码,然后他们会被保存到"ccmtv.ini"配置文件中,日后自动从配置文件中读取用户名和密码,如果需要修改登陆信息,直接删除"ccmtv.ini",重新运行工具即可。由于没钱买代码签名证书,就用了银行的ukey签了一下,下载的时候可能会冒出提示=_=无视掉就好了。

纵观历史,看起来懒是推动效率提升的重要动力。自行车、电梯、计算器……都是为了方便生活,提升效率,解决现实问题而产生的。人类工具等的发展就是不断突破效率而建立起来的,溯其出发点或许就是为了能让自己能在工作生活中“懒”一点。

在我看来,懒从来都不是一个太差的特质,或许这是一种对高效率的向往与追求。

花式给自己找借口

2020.5.22修改了header参数,文末打包好的软件未进行修改。请自行取用源代码执行或打包。

以下是代码🐎

# -*- coding: utf-8 -*-
import requests, json
from time import sleep
from sys import exit
from os import path

def initconfig():
    global username,passwd
    username= input("Please Input Username.\n")
    passwd = input("Then Please Input Password.\n")
    with open("ccmtv.ini", "w") as f:
        print("[*] Creating Config File")
        json.dump({"username":username,"passwd":passwd},f)

if path.exists("ccmtv.ini"):
    with open("ccmtv.ini", "r") as f:
        print("[*] Loading Username & Password From Config File\n")
        i=json.load(f)
        try:
            username,passwd=i["username"],i["passwd"]
        except:
            print("[!] Loading Config Failed\n")
            initconfig()
else:
    initconfig()


headers = {
    "accept": "*/*",
    "accept-encoding": "gzip, deflate",
    "accept-language": "zh-CN,zh;q=0.9",
    "cache-control": "no-cache",
    "connection": "keep-alive",
    "host": "yun.ccmtv.cn",
    "pragma": "no-cache",
    "User-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"}

loginurl = "http://www.ccmtv.cn/upload_files/new_upload_files/ccmtvtp/Loginreg/Login/loginCheck.html"
taskurl = "http://www.ccmtv.cn/upload_files/new_upload_files/ccmtvtp/Member/Yktask/noListAjax.html"
signurl = "http://yun.ccmtv.cn/Video/signInData.html"
logouturl = "http://www.ccmtv.cn/upload_files/new_upload_files/ccmtvtp/Member/Index/loginout.html"
videologurl="http://yun.ccmtv.cn/Video/addVideoLog"

cookie = requests.cookies.RequestsCookieJar()
s = requests.Session()
s.headers = headers
s.cookies = cookie
loginreq = {"username": username, "password": passwd}
login = s.post(loginurl, loginreq)
if login.status_code == 200 and json.loads(login.text) == "http://www.ccmtv.cn":
    print("[+] Login Successfully\n")
else:
    print("[!] Login Failed\n")
    input("Press Enter to exit\n")
    exit()

task = s.get(taskurl)
if task.status_code == 200:
    print("[+] Fetch TaskList Successfully\n")
else:
    print("[!] Fetch TaskList Failed\n")
    input("Press Enter to exit\n")
    exit()

tasklist = json.loads(task.text)
c = {i["tid"]: (json.loads(i["sign_num"]), json.loads(i["taskitem"])["1"]) for i in tasklist["list"] if
     i["rate_of_progress"] < 100}
if not bool(c):
    print("[+] Do Not Need to Sign\n")
    input("Press Enter to exit\n")
    exit()

def signreq():
    for tid, t in c.items():
        for aid in t[1]:
            for n in range(t[0]):
                yield ({"aid": aid, "tid": tid, "sign_num": n})

def videologreq():
    for tid, t in c.items():
        for aid in t[1]:
             yield ({"aid": aid})

for req in signreq():
    s.post(signurl, req)
    sleep(0.2)

for req in videologreq():
    b=s.post(videologurl,req)
    sleep(0.2)

print("[+] All Tasks are already Signed\n")
print("[+] Please Check Yi Xia =_=\n")
s.get(logouturl)
s.close()
input("Press Enter to exit\n")

ccmtv高效学习工具-win

bear-5021810.jpg

Last Modified: December 19, 2023
Archives QR Code Tip
QR Code for this page
Tipping QR Code
Leave a Comment

6 Comments
  1. Lynette Lynette

    被医学耽误的程序员

  2. Eason Eason

    我们用腾讯会议

    1. @Eason听起来是正经讲课🌚

    2. Eason Eason

      @半斤锵烤铜就是小讲课,基本就是规培生,带教老师,教秘参加,每周一节课

  3. neutrophil neutrophil

    下次一定

    1. @neutrophil🌚🌚🌚