Open lili205 opened 5 years ago
视频,文章看的个数分拿到以后,换个看过的文章和长视频,把时长分拿到。
很好的办法,
扫码登录也可以换成手机号密码登录 这样就能全部headless 运行了 挂服务器上了
def login(phone, password: str):
"""
phone = ("+86", "13800138000")
"""
logger.info("程序开启")
driver.get("https://pc.xuexi.cn/points/login.html")
driver.get("https://login.dingtalk.com/login/index.htm?goto=https%3A%2F%2Foapi.dingtalk.com%2Fconnect%2Foauth2%2Fsns_authorize%3Fappid%3Ddingoankubyrfkttorhpou%26response_type%3Dcode%26scope%3Dsnsapi_login%26redirect_uri%3Dhttps%3A%2F%2Fpc-api.xuexi.cn%2Fopen%2Fapi%2Fsns%2Fcallback")
driver.find_element_by_xpath("//select[@class='country_code_select']/option[@value='{}']".format(phone[0])).click()
driver.find_element_by_xpath("//div[@id='mobilePlaceholder']").click()
driver.find_element_by_xpath("//input[@id='mobile']").send_keys(phone[1])
driver.execute_script("document.getElementById('pwd').setAttribute('style', 'display: inline-block')")
driver.find_element_by_xpath("//input[@id='pwd']").click()
driver.find_element_by_xpath("//input[@id='pwd']").send_keys(password)
driver.find_element_by_xpath("//a[@id='loginBtn']").click()
WebDriverWait(driver, 270).until(EC.title_is(u"我的学习"))
cookies = driver.get_cookies()
with open("./user/{}/cookies.txt".format(user_name), "w") as fp:
json.dump(cookies, fp)
check(phone, password)
@mengyyy 这个牛逼。
@ @mengyyy 大佬牛逼
扫码登录也可以换成手机号密码登录 这样就能全部headless 运行了 挂服务器上了
def login(phone, password: str): """ phone = ("+86", "13800138000") """ logger.info("程序开启") driver.get("https://pc.xuexi.cn/points/login.html") driver.get("https://login.dingtalk.com/login/index.htm?goto=https%3A%2F%2Foapi.dingtalk.com%2Fconnect%2Foauth2%2Fsns_authorize%3Fappid%3Ddingoankubyrfkttorhpou%26response_type%3Dcode%26scope%3Dsnsapi_login%26redirect_uri%3Dhttps%3A%2F%2Fpc-api.xuexi.cn%2Fopen%2Fapi%2Fsns%2Fcallback") driver.find_element_by_xpath("//select[@class='country_code_select']/option[@value='{}']".format(phone[0])).click() driver.find_element_by_xpath("//div[@id='mobilePlaceholder']").click() driver.find_element_by_xpath("//input[@id='mobile']").send_keys(phone[1]) driver.execute_script("document.getElementById('pwd').setAttribute('style', 'display: inline-block')") driver.find_element_by_xpath("//input[@id='pwd']").click() driver.find_element_by_xpath("//input[@id='pwd']").send_keys(password) driver.find_element_by_xpath("//a[@id='loginBtn']").click() WebDriverWait(driver, 270).until(EC.title_is(u"我的学习")) cookies = driver.get_cookies() with open("./user/{}/cookies.txt".format(user_name), "w") as fp: json.dump(cookies, fp) check(phone, password)
改下你手机号大哥,隐私啊
没看懂,为什么非要换一个文章或视频挂时长?
@Liridice 文章时长可以不用换,视频手动操作的时候,都是拉短视频算个数,换长视频挂满时长。
@zyftank 只要保证在挂满视频时长的同时把视频个数达标可以了吧,换了有什么好处,该看多长时间还是要看多长时间。
看来今天没戏,明天请早!!!
扫码登录也可以换成手机号密码登录 这样就能全部headless 运行了 挂服务器上了
def login(phone, password: str): """ phone = ("+86", "13800138000") """ logger.info("程序开启") driver.get("https://pc.xuexi.cn/points/login.html") driver.get("https://login.dingtalk.com/login/index.htm?goto=https%3A%2F%2Foapi.dingtalk.com%2Fconnect%2Foauth2%2Fsns_authorize%3Fappid%3Ddingoankubyrfkttorhpou%26response_type%3Dcode%26scope%3Dsnsapi_login%26redirect_uri%3Dhttps%3A%2F%2Fpc-api.xuexi.cn%2Fopen%2Fapi%2Fsns%2Fcallback") driver.find_element_by_xpath("//select[@class='country_code_select']/option[@value='{}']".format(phone[0])).click() driver.find_element_by_xpath("//div[@id='mobilePlaceholder']").click() driver.find_element_by_xpath("//input[@id='mobile']").send_keys(phone[1]) driver.execute_script("document.getElementById('pwd').setAttribute('style', 'display: inline-block')") driver.find_element_by_xpath("//input[@id='pwd']").click() driver.find_element_by_xpath("//input[@id='pwd']").send_keys(password) driver.find_element_by_xpath("//a[@id='loginBtn']").click() WebDriverWait(driver, 270).until(EC.title_is(u"我的学习")) cookies = driver.get_cookies() with open("./user/{}/cookies.txt".format(user_name), "w") as fp: json.dump(cookies, fp) check(phone, password)
改下你手机号大哥,隐私啊
13800138000 有什么好改的……
大佬,我提几个建议,视频个数其实可以快进看完,阅读文章只要10秒就可以关闭的,还有每天的新闻联播视频短的快进,长的看完,省心省力