Comments (42)
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()
from panda-learning.
用上面的内容代替源文件
from panda-learning.
你qq发给我控制我电脑看看把嘻嘻小白我[email protected]
from panda-learning.
这也是我qq
from panda-learning.
或者你把更新好的软件发出来哈哈大神
from panda-learning.
修改mydriver.py里面的url为https://pc.xuexi.cn/points/login.html?ref=https://pc.xuexi.cn/points/my-study.html即可。
from panda-learning.
再重新pyinstaller进行exe打包覆盖原文件即可。附上我修改打包ok的exe。
pandalearning.zip
from panda-learning.
from panda-learning.
from panda-learning.
不会啊,我测试OK才上传的
from panda-learning.
from panda-learning.
不会啊,我测试OK才上传的
大佬,不能下载,发个邮箱谢谢,好人一生平安[email protected]
from panda-learning.
from panda-learning.
链接: https://pan.baidu.com/s/1cYEaorlMj_GhV0ti8eLCWQ 提取码: msvv 复制这段内容后打开百度网盘手机App,操作更方便哦
from panda-learning.
感谢大佬
from panda-learning.
用大佬的文体替代了,在这里停留了起码5分钟,最后终于开始学习了,谢谢大佬!
from panda-learning.
为什么我家电脑64位的打开就闪退打开32位的没事不过还是系统维护
from panda-learning.
你能发一下你的软件的文件给我吗qq1960971987我试了替换了打开按两下回车会闪退
from panda-learning.
链接:https ://pan.baidu.com/s/1cYEaorlMj_GhV0ti8eLCWQ提取代码:msvv复制这段内容后打开百度网盘手机应用程序,操作更方便哦
非常感谢!
from panda-learning.
你能发一下你的软件的文件给我吗qq1960971987我试了替换了打开按两下回车会闪退
链接:https ://pan.baidu.com/s/1cYEaorlMj_GhV0ti8eLCWQ提取代码:msvv
from panda-learning.
我下载替换了你们谁能把能用的直接发过来我试试看!!
from panda-learning.
再重新pyinstaller进行exe打包覆盖原文件即可。附上我修改打包ok的exe。
pandalearning.zip
下载大佬在这里发出的这个连接吧
from panda-learning.
我下载替换了你们谁能把能用的直接发过来我试试看!!
解压缩后右键,给与管理员权限运行,兼容性可以选xp
from panda-learning.
from panda-learning.
感谢感谢!!!
from panda-learning.
下载pandalearning.zip解压之后替换源文件就可以正常扫码登入了,感谢感谢!
上面的百度链接
链接:https://pan.baidu.com/s/1cYEaorlMj_GhV0ti8eLCWQ提取代码:msvv复制这段内容后打开百度网盘手机应用程序,操作更方便哦
from panda-learning.
发现文章学习线程偶尔会出问题(最近出现的,之前没有),导致文章不被学习。把错误代码发上来看看
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
from panda-learning.
改代码上面有人已经回复了,其实就改了一个网址,不影响其他地方。
from panda-learning.
再重新pyinstaller进行exe打包覆盖原文件即可。附上我修改打包ok的exe。
pandalearning.zip
能否封装一个32位的EXE,我32位电脑没法用你这个64位的EXE
from panda-learning.
再重新pyinstaller进行exe打包覆盖原文件即可。附上我修改打包ok的exe。
pandalearning.zip能否封装一个32位的EXE,我32位电脑没法用你这个64位的EXE
额我Python是64bit的。。。。
from panda-learning.
今天下午突然发现二维码的图片显示不了,请问大家遇到了吗?
from panda-learning.
遇到了,不显示,好像是浏览器被禁止显示图片了,但是改不了。
from panda-learning.
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')
是不是启动CHROME时屏蔽图片的问题?我用普通浏览器直接打开URL是会加载图片的。手上没有源码,有没有大佬重新打包下试试~~
from panda-learning.
二维码图片显示不了 哭了
from panda-learning.
用别的浏览器打开会加载,这个Chrome打开就不会加载图片
from panda-learning.
二维码不加载了
from panda-learning.
链接: https://pan.baidu.com/s/13GXMmMgJaWC5Y8TZmuKjoA 提取码: bu5s
64bit版本,已修改不能显示图片部分,自测可用,按需自取。
from panda-learning.
链接: https://pan.baidu.com/s/13GXMmMgJaWC5Y8TZmuKjoA 提取码: bu5s
64bit版本,已修改不能显示图片部分,自测可用,按需自取。
大佬,能否做个32bit的版本,不胜感激
from panda-learning.
链接: https://pan.baidu.com/s/13GXMmMgJaWC5Y8TZmuKjoA 提取码: bu5s
64bit版本,已修改不能显示图片部分,自测可用,按需自取。大佬,能否做个32bit的版本,不胜感激
链接: https://pan.baidu.com/s/1WHkBjt_xC6aEZJlIEP16CA 提取码: txe6
我自己的电脑会被认为是木马,我64bit系统测试没问题,你试试吧。
from panda-learning.
链接: https://pan.baidu.com/s/13GXMmMgJaWC5Y8TZmuKjoA 提取码: bu5s
64bit版本,已修改不能显示图片部分,自测可用,按需自取。
感谢!
from panda-learning.
把mydriver.py里头的false改成true即可解决
from panda-learning.
修改好了.请问大家钉钉接口还能用吗?
from panda-learning.
Related Issues (20)
- 全自动59分 电报群:https://t.me/xxqgfxq
- 保存账号密码登录失败,每次登录都得扫码
- 全自动59分 电报群:https://t.me/joinchat/MYWaBlNhJau7SjLC7zPKHg
- 邀请59积分电报组织群:https://t.me/joinchat/MYWaBlNhJatwvVXuTRCgnA
- 。。。
- 最近好像不能用了 显示系统维护 HOT 16
- 不能文章阅读了 HOT 2
- 请大佬帮忙看看这个,学习强国二维码不出现 HOT 12
- 学习研究代码 请勿传播 HOT 14
- 更新维护【欢迎大神更新】 HOT 66
- > python生成exe文件 HOT 8
- 登录二维码不显示 HOT 4
- 欢迎各位大神提交源代码和二进制文件更新到这里https://github.com/PandaLearning/Panda-Learning ,持续更新中……
- 便利峰0撸500ML可口可乐 支付宝或微信扫码进入领取,领取了去门店出示二维码兑换就行了,亲测0撸稳! 有能撸的城市:北京/天津/南京/廊坊/上海/无锡/苏州/杭州
- 今天被封 HOT 8
- windows pc端扫码后不会往下走啊,有人解决一下嘛
- windows下如何使用用户名和密码自动登录,不用扫二维码 HOT 2
- 6个视频学习不能完全学完
- anything wrong with the code unwritten
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 panda-learning.