壁紙 Web サイトにアクセスするための Python コードを作成します。

import request from bs4 import BeautifulSoupurl = " https://wallpapercave.com/"#Webサイト データのリクエスト result =requests.get(url)# BeautifulSoup オブジェクトの作成Soup = BeautifulSoup(result.text, "html.parser")# すべての壁紙を検索wallpaper_elements =Soup.find_all("img", {"class": "wallpaper__thumb"})# 壁紙要素を走査し、壁紙 i の壁紙ダウンロード アドレスを取得します。

おすすめ

転載: blog.csdn.net/weixin_35749440/article/details/129513271