Panda-Learning
Panda-Learning copied to clipboard
pdlearn目录下面mydriver.py文件中的
看不明白咋解决你的意思我明白如何解决这个问题
coding=gbk
from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common import exceptions from selenium.webdriver.chrome.options import Options from pdlearn import user_agent import os
class Mydriver:
def __init__(self, noimg=True, nohead=True):
try:
self.options = Options()
if os.path.exists("./chrome/chrome.exe"): # win
self.options.binary_location = "./chrome/chrome.exe"
elif os.path.exists("/opt/google/chrome/chrome"): # linux
self.options.binary_location = "/opt/google/chrome/chrome"
if noimg:
self.options.add_argument('blink-settings=imagesEnabled=false') # 不加载图片, 提升速度
if nohead:
self.options.add_argument('--headless')
self.options.add_argument('--disable-extensions')
self.options.add_argument('--disable-gpu')
self.options.add_argument('--no-sandbox')
self.options.add_argument('--mute-audio') # 关闭声音
self.options.add_argument('--window-size=400,500')
self.options.add_argument('--window-position=800,0')
self.options.add_argument('--log-level=3')
self.options.add_argument('--user-agent={}'.format(user_agent.getheaders()))
self.options.add_experimental_option('excludeSwitches', ['enable-automation']) # 绕过js检测
self.webdriver = webdriver
if os.path.exists("./chrome/chromedriver.exe"): # win
self.driver = self.webdriver.Chrome(executable_path="./chrome/chromedriver.exe",
chrome_options=self.options)
elif os.path.exists("./chromedriver"): # linux
self.driver = self.webdriver.Chrome(executable_path="./chromedriver",
chrome_options=self.options)
elif os.path.exists("/usr/lib64/chromium-browser/chromedriver"): # linux 包安装chromedriver
self.driver = self.webdriver.Chrome(executable_path="/usr/lib64/chromium-browser/chromedriver",
chrome_options=self.options)
elif os.path.exists("/usr/local/bin/chromedriver"): # linux 包安装chromedriver
self.driver = self.webdriver.Chrome(executable_path="/usr/local/bin/chromedriver",
chrome_options=self.options)
else:
self.driver = self.webdriver.Chrome(chrome_options=self.options)
except:
print("=" * 120)
print("Mydriver初始化失败")
print("=" * 120)
raise
def login(self):
print("正在打开二维码登陆界面,请稍后")
self.driver.get("https://pc.xuexi.cn/points/login.html")
try:
remover = WebDriverWait(self.driver, 30, 0.2).until(
lambda driver: driver.find_element_by_class_name("redflagbox"))
except exceptions.TimeoutException:
print("网络缓慢,请重试")
else:
self.driver.execute_script('arguments[0].remove()', remover)
try:
remover = WebDriverWait(self.driver, 30, 0.2).until(
lambda driver: driver.find_element_by_class_name("header"))
except exceptions.TimeoutException:
print("当前网络缓慢...")
else:
self.driver.execute_script('arguments[0].remove()', remover)
try:
remover = WebDriverWait(self.driver, 30, 0.2).until(
lambda driver: driver.find_element_by_class_name("footer"))
except exceptions.TimeoutException:
print("当前网络缓慢...")
else:
self.driver.execute_script('arguments[0].remove()', remover)
self.driver.execute_script('window.scrollTo(document.body.scrollWidth/2 - 200 , 0)')
try:
WebDriverWait(self.driver, 270).until(EC.title_is(u"系统维护中"))
cookies = self.get_cookies()
return cookies
except:
print("扫描二维码超时")
def dd_login(self, d_name, pwd):
__login_status = False
self.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"
)
self.driver.find_elements_by_id("mobilePlaceholder")[0].click()
self.driver.find_element_by_id("mobile").send_keys(d_name)
self.driver.find_elements_by_id("mobilePlaceholder")[1].click()
self.driver.find_element_by_id("pwd").send_keys(pwd)
self.driver.find_element_by_id("loginBtn").click()
try:
print("登陆中...")
WebDriverWait(self.driver, 2, 0.1).until(lambda driver: driver.find_element_by_class_name("modal"))
print(self.driver.find_element_by_class_name("modal").find_elements_by_tag_name("div")[0].text)
self.driver.quit()
__login_status = False
except:
__login_status = True
return __login_status
def get_cookies(self):
cookies = self.driver.get_cookies()
return cookies
def set_cookies(self, cookies):
for cookie in cookies:
self.driver.add_cookie({k: cookie[k] for k in cookie.keys()})
def get_url(self, url):
self.driver.get(url)
def go_js(self, js):
self.driver.execute_script(js)
def quit(self):
self.driver.quit()
用上面的内容代替源文件
你qq发给我控制我电脑看看把嘻嘻小白我[email protected]
这也是我qq
或者你把更新好的软件发出来哈哈大神
修改mydriver.py里面的url为https://pc.xuexi.cn/points/login.html?ref=https://pc.xuexi.cn/points/my-study.html即可。
再重新pyinstaller进行exe打包覆盖原文件即可。附上我修改打包ok的exe。 pandalearning.zip
为什么下载不了你试试qq传给我兄弟谢谢你
------------------ 原始邮件 ------------------ 发件人: "ShingoXY"<[email protected]>; 发送时间: 2020年3月24日(星期二) 下午2:48 收件人: "Alivon/Panda-Learning"<[email protected]>; 抄送: "温柔的女汉子"<[email protected]>; "Author"<[email protected]>; 主题: Re: [Alivon/Panda-Learning] pdlearn目录下面mydriver.py文件中的 (#500)
再重新pyinstaller进行exe打包覆盖原文件即可。附上我修改打包ok的exe。 pandalearning.zip
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
我替换好了还不行
------------------ 原始邮件 ------------------ 发件人: "ShingoXY"<[email protected]>; 发送时间: 2020年3月24日(星期二) 下午2:48 收件人: "Alivon/Panda-Learning"<[email protected]>; 抄送: "温柔的女汉子"<[email protected]>; "Author"<[email protected]>; 主题: Re: [Alivon/Panda-Learning] pdlearn目录下面mydriver.py文件中的 (#500)
再重新pyinstaller进行exe打包覆盖原文件即可。附上我修改打包ok的exe。 pandalearning.zip
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
不会啊,我测试OK才上传的
真的下载不了我试了手机电脑都不行你QQ穿给我文件发给我试试看------------------ 原始邮件 ------------------ 发件人: "ShingoXY"[email protected] 发送时间: 2020年3月24日(星期二) 下午5:19 收件人: "Alivon/Panda-Learning"[email protected]; 抄送: "admin123-admin"[email protected];"Author"[email protected]; 主题: Re: [Alivon/Panda-Learning] pdlearn目录下面mydriver.py文件中的 (#500)
不会啊,我测试OK才上传的
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
好多人都不能下载
------------------ 原始邮件 ------------------ 发件人: "ShingoXY"<[email protected]>; 发送时间: 2020年3月24日(星期二) 下午5:19 收件人: "Alivon/Panda-Learning"<[email protected]>; 抄送: "温柔的女汉子"<[email protected]>; "Author"<[email protected]>; 主题: Re: [Alivon/Panda-Learning] pdlearn目录下面mydriver.py文件中的 (#500)
不会啊,我测试OK才上传的
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
链接: https://pan.baidu.com/s/1cYEaorlMj_GhV0ti8eLCWQ 提取码: msvv 复制这段内容后打开百度网盘手机App,操作更方便哦
感谢大佬
用大佬的文体替代了,在这里停留了起码5分钟,最后终于开始学习了,谢谢大佬!
为什么我家电脑64位的打开就闪退打开32位的没事不过还是系统维护
用大佬的文体替代了,在这里停留了起码5分钟,最后终于开始学习了,谢谢大佬!
你能发一下你的软件的文件给我吗qq1960971987我试了替换了打开按两下回车会闪退
链接:https ://pan.baidu.com/s/1cYEaorlMj_GhV0ti8eLCWQ提取代码:msvv复制这段内容后打开百度网盘手机应用程序,操作更方便哦 非常感谢!
用大佬的文体替代了,在这里停留了起码5分钟,最后终于开始学习了,谢谢大佬!
你能发一下你的软件的文件给我吗qq1960971987我试了替换了打开按两下回车会闪退
链接:https ://pan.baidu.com/s/1cYEaorlMj_GhV0ti8eLCWQ提取代码:msvv
我下载替换了你们谁能把能用的直接发过来我试试看!!
我下载替换了你们谁能把能用的直接发过来我试试看!!
解压缩后右键,给与管理员权限运行,兼容性可以选xp
不会啊,我测试OK才上传的
感谢感谢!!!
下载pandalearning.zip解压之后替换源文件就可以正常扫码登入了,感谢感谢!
上面的百度链接
链接:https://pan.baidu.com/s/1cYEaorlMj_GhV0ti8eLCWQ提取代码:msvv复制这段内容后打开百度网盘手机应用程序,操作更方便哦

发现文章学习线程偶尔会出问题(最近出现的,之前没有),导致文章不被学习。把错误代码发上来看看 Exception in thread 文章学习: Traceback (most recent call last): File "threading.py", line 926, in _bootstrap_inner File "pdlearn\threads.py", line 23, in run File "pandalearning.py", line 66, in article IndexError: list index out of range
改代码上面有人已经回复了,其实就改了一个网址,不影响其他地方。
再重新pyinstaller进行exe打包覆盖原文件即可。附上我修改打包ok的exe。 pandalearning.zip
能否封装一个32位的EXE,我32位电脑没法用你这个64位的EXE
额我Python是64bit的。。。。