반응형
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# write by chatgpt | |
# | |
import requests | |
import os | |
from bs4 import BeautifulSoup | |
base_url = "https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/" | |
response = requests.get(base_url) | |
soup = BeautifulSoup(response.text, "html.parser") | |
for tr in soup.find_all("tr", class_="folder"): | |
title = tr.get("title") | |
if title is not None: | |
folder = title | |
folder_url = base_url + folder | |
os.system( f'mkdir -p {folder}' ) | |
response = requests.get(folder_url) | |
folder_soup = BeautifulSoup(response.text, "html.parser") | |
for tr in folder_soup.find_all("tr", class_="file"): | |
file_title = tr.get("title") | |
if file_title is not None: | |
file_url = f'{folder_url}/{file_title}' | |
wget_command = f'wget {file_url} -O {folder}/{file_title}' | |
print(wget_command) | |
os.system(wget_command) |
반응형
'chatgpt > coding with ai' 카테고리의 다른 글
[Review other people's prompts - try autogpt] - Stairway To Heaven (0) | 2023.10.12 |
---|---|
[ChatGPT] Automate blog creation with OPENAI API (ChatGPT) (0) | 2023.03.06 |
[golang] code2GPT (0) | 2023.02.09 |
[c++] code2GPT (0) | 2023.02.07 |
[bash shell] code2GPT (0) | 2023.02.07 |