3 Star 36 Fork 15

魂穆河/DrissionPageX

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
魂穆河 更新 2037349 5个月前
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

✨️ 概述

只挖坑,不填坑 只挖坑,不填坑 只挖坑,不填坑 原项目地址: gitee | github

🛠 模拟手机1

from DrissionPage import ChromiumPage
from DrissionPage_Pligin.Phone import Phone, Touch

# 实例化浏览器
page = ChromiumPage()
# 初始化成为手机
Phone(page).IphoneSe()
page.get("https://www.baidu.com/")
input_node = page.ele('xpath:.//input[@name="word"]')
if input_node != None:
    input_node.input("啊,这是真的么")
# 点击使用Touch方案,click有时候无效
button_node = page.ele('xpath:.//button[text()="百度一下"]')
if button_node != None:
    Touch(button_node)
input("")

🛠 模拟手机2

from DrissionPage import ChromiumPage
from DrissionPage_Pligin.Phone import Phone, Touch, Node_Move

# 实例化浏览器
page = ChromiumPage()
# 初始化成为手机
Phone(page).IphoneSe()
page.get("https://www.geetest.com/Sensebot")
input("")
# 点击使用Touch方案,click有时候无效
button_node = page.ele('xpath:.//li[text()="滑动/滑块验证"]')
if button_node != None:
    Touch(button_node)
input("")

button_node = page.ele('xpath:.//span[text()="点击按钮进行验证"]')
if button_node != None:
    Touch(button_node)
input("")

button_node = page.ele('xpath:.//div[@class="geetest_slider_button"]')
if button_node != None:
    Node_Move(button_node, 300, 0)
input("")

🛠 监听websocket

from DrissionPage_Pligin.Listen_Ws import Listen_Ws
from DrissionPage import ChromiumPage

page = ChromiumPage()
listen_ws = Listen_Ws(page)
page.get("http://coolaf.com/tool/chattest")
listen_ws.start()
for pkg in listen_ws.steps(timeout=10):
    print(pkg)
listen_ws.stop()

🛠 监听console.log

from DrissionPage_Pligin.Listen_Console import Listen_Console
from DrissionPage import ChromiumPage

page = ChromiumPage()
listen_console = Listen_Console(page)
listen_console.start()
page.get("https://www.baidu.com/")
for pkg in listen_console.steps(timeout=10):
    print(pkg)
listen_console.stop()

🛠 利用dp打断点,获取加密参数

请跳转: 快手弹幕

🛠 切换IP_V1

from DrissionPage import ChromiumPage
from DrissionPage_Pligin.Set_Proxies_V1 import Set_Proxies_V1
# https://copyright.bdstatic.com/vcg/creative/cc9c744cf9f7c864889c563cbdeddce6.jpg@h_1280
# https://ip.900cha.com/
page = ChromiumPage()
input("开始使用本机IP")
proxies = None
Set_Proxies_V1(page)
while True:
    input("切换IP")
    proxies = {
        "http": "http://<proxy_ip>:<proxy_port>",
        "https": "https://<proxy_ip>:<proxy_port>",
    }
    Set_Proxies_V1(page, proxies=proxies)

🛠 切换IP_V2

from DrissionPage import WebPage, ChromiumOptions
from DrissionPage_Pligin.Set_Proxies_V2 import Set_Proxies_V2


proxy = Set_Proxies_V2()
co = ChromiumOptions()
co.set_local_port(11112)
co.add_extension(r"Extension\Porxy")
page = WebPage(chromium_options=co)
page.get("https://www.ip138.com/")
while True:
    host = input("host:")
    port = input("port:")
    # _dict = {
    #     "scheme": "http",
    #     "host": "your-proxy-ip",
    #     "port": 1234,
    #     "username": "your-username",
    #     "password": "your-password",
    # }
    proxy.Set_Ip(host,port)
    page.refresh()


🛠 切换IP,他人代理方案

🛠 如何使用

📖 使用文档: 点击查看

交流 QQ 群: 636361957

BSD 3-Clause License Copyright (c) 2020, g1879 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

基于DrissionPage库二开 展开 收起
Python 等 2 种语言
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Hunmuhe/DrissionPageX.git
git@gitee.com:Hunmuhe/DrissionPageX.git
Hunmuhe
DrissionPageX
DrissionPageX
master

搜索帮助