update du projet, xml collection enlevé et méthode fait maison ajouter
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 160 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 378 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 218 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 4.7 MiB |
|
After Width: | Height: | Size: 560 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 133 KiB |
|
After Width: | Height: | Size: 9.9 MiB |
|
After Width: | Height: | Size: 196 KiB |
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Download the index page and convert local links to global links
|
||||
url="https://www.memo-dg.fr/"
|
||||
curl $url > index.html
|
||||
|
||||
# Extract the image URLs from the downloaded HTML file
|
||||
cat index.html | grep img | grep -Po 'src="\K.*?(?=")' | sed 's/\?.*//' > links.txt
|
||||
|
||||
# Download all the images using curl
|
||||
while read -r file; do
|
||||
curl -s -O $file
|
||||
done < links.txt
|
||||
|
||||
# Clean up
|
||||
rm index.html links.txt
|
||||
|
After Width: | Height: | Size: 4.5 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 10 MiB |
|
After Width: | Height: | Size: 165 KiB |
|
After Width: | Height: | Size: 360 KiB |
|
After Width: | Height: | Size: 4.9 MiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 642 KiB |
|
After Width: | Height: | Size: 348 KiB |
|
After Width: | Height: | Size: 311 KiB |
|
After Width: | Height: | Size: 424 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 188 KiB |
|
After Width: | Height: | Size: 371 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 954 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 303 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 572 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 382 KiB |
|
After Width: | Height: | Size: 235 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 151 KiB |
|
After Width: | Height: | Size: 156 KiB |
|
After Width: | Height: | Size: 611 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 211 KiB |
|
After Width: | Height: | Size: 252 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 189 KiB |
|
After Width: | Height: | Size: 943 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 156 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 106 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 695 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 478 KiB |
@@ -0,0 +1,39 @@
|
||||
import os
|
||||
import sys
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from urllib.parse import urljoin, urlparse
|
||||
import urllib.request
|
||||
|
||||
def main(url):
|
||||
try:
|
||||
response = requests.get(url, headers={"User-Agent": "Mozilla/5.0"})
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"Error: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
soup = BeautifulSoup(response.text, 'html.parser')
|
||||
images = soup.find_all('img')
|
||||
|
||||
if not os.path.exists("images"):
|
||||
os.makedirs("images")
|
||||
|
||||
for image in images:
|
||||
img_src = image.get('src')
|
||||
img_url = urljoin(url, img_src)
|
||||
local_filename = urlparse(img_url).path.split('/')[-1]
|
||||
|
||||
try:
|
||||
urllib.request.urlretrieve(img_url, os.path.join("images", local_filename))
|
||||
print(f"Downloaded {img_url}")
|
||||
except Exception as e:
|
||||
print(f"Error downloading {img_url}: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python script.py <URL>")
|
||||
sys.exit(1)
|
||||
|
||||
url = sys.argv[1]
|
||||
main(url)
|
||||
|
After Width: | Height: | Size: 216 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 4.1 MiB |
|
After Width: | Height: | Size: 165 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 5.4 MiB |
|
After Width: | Height: | Size: 828 KiB |
|
After Width: | Height: | Size: 319 KiB |
|
After Width: | Height: | Size: 366 KiB |
|
After Width: | Height: | Size: 38 KiB |