Python:获取pywebview当前URL

2024-06-01 11:28:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用pywebview库打开一个页面,该页面将用户重定向到另一个url。我想做的是获取用户指向的URL。在

目前我的代码:

import urllib.request
import urllib.parse
import webview
import threading
import time

def openwebview():
    time.sleep(1)
    page = webview.create_window("URL_that_redirects_user")

def geturl():
    #what goes here?

t = threading.Thread(target = openwebview)
t.start()

我在用窗户,谢谢!在


Tags: 代码用户importurltimedef页面urllib
2条回答

现在你可以做到:

def geturl():
    print(webview.get_current_url())

请看这里: https://github.com/r0x0r/pywebview/blob/master/examples/get_current_url.py

这里是pywebview的作者。无法获取当前URL。Uou必须挖掘底层的webview来获取URL。 谢谢你的建议,我会考虑介绍这个功能。在

相关问题 更多 >