如何在 JMP 18 中使用 python 操作 selenium?我想自動抓取網頁內容並獲取真實的URL。
例如
https://xvfr.com/60s.html
其本質只是圖片真實網站https://g.gtimg.cn/music/photo_new/T053XD001001eyb6g4JwXRW.png
頁面來源碼中沒有這個圖片位址的內容,但是每天都是不同的位址
我已經在 JMP python 中安裝了以下庫
jmputils.jpip('install', 'selenium')
jmputils.jpip('install', 'requests')感謝專家!
基礎資料分析與建模視窗回覆:如何在 JMP 18 中使用 python 操作 selenium?如果你需要從圖片中獲取文本,這稱為 OCR(光學字元辨識)。它聲稱支援多種語言。
回覆:如何在 JMP 18 中使用 python 操作 selenium?我已經解決了圖片OCR問題。

重點是這個圖片的地址每天都不一樣,我不想手動去取得。
請參閱 Craige Expert 的原始部落格。但它太複雜了。我不明白。
所以我想自動取得這個網站圖片的真實地址。
謝謝克雷格!
回覆:如何在 JMP 18 中使用 python 操作 selenium?現在我想弄清楚如何結合JMP 18 python每天自動獲取這個圖像的不同地址來下載和識別JSL。
回覆:如何在 JMP 18 中使用 python 操作 selenium?聊天GPT

我對python了解更少。
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import time
# Set the path to your ChromeDriver
service = Service(executable_path="path/to/chromedriver")
# Initialize the browser
options = webdriver.ChromeOptions()
options.add_argument('--headless') # Run in headless mode to avoid opening a browser window
browser = webdriver.Chrome(service=service, options=options)
# Visit the target webpage
browser.get("https://xvfr.com/60s.html")
# Wait for the page to load
time.sleep(5) # Wait 5 seconds for the page to load completely; you can use WebDriverWait for better handling
# Get all network requests
logs = browser.get_log('performance')
# Parse network requests to find the image URL
for log in logs:
if 'https://g.gtimg.cn/music/photo_new' in str(log):
print("Found image URL:", str(log))
# Close the browser
browser.quit()