5 Commits

Author SHA1 Message Date
Mara Karagianni
c5cfa7f21a test 2025-10-01 11:26:17 +02:00
Mara Karagianni
4e5642a83b art python intro 2024-11-06 21:55:05 +01:00
Mara Karagianni
e13b25bbcd translate scraping README in french 2024-10-31 19:48:56 +01:00
Mara Karagianni
ad3a364347 add python image scrape script 2024-10-31 19:25:04 +01:00
Mara Karagianni
7ef8f2ffd5 add gitignore file 2024-10-31 19:06:32 +01:00
10 changed files with 165 additions and 31 deletions

10
.gitignore vendored Normal file
View File

@@ -0,0 +1,10 @@
# Environments
venv/
.venv/
/pyvenv.cfg
.python-version
# Media
media/
downloaded_images
downloaded_videos

View File

@@ -1,4 +1,5 @@
# git repo for art num # git repo for art num
*the wiki will be updated with more information and usefull snipet. fell free to contribute* *the wiki will be updated with more information and usefull snipet. fell free to contribute*
test port ssh test port ssh

View File

@@ -0,0 +1,16 @@
## introduction
```
variables
list --> bisous.py programming.py
input --> bisous.py
print
for loop --> bisous.py
conditional statements if/else/elif --> bisous.py
break --> bisous.py
while loop --> missing.py
dictionary
enumerate
return --> missing.py
random --> programming.py
function --> missing.py
```

View File

@@ -0,0 +1,19 @@
# Initialiser les variables
queer = "mon amour"
bisous = ["ma biche", "mom bébé", "mon amour", "mon chéri.e"]
# Demander une saisie à l'utilisateur
amoureuxse = input("Entrez le nom de votre bien-aiméx : ")
# Boucler à travers la liste et imprimer le message correspondant
for bisou in bisous:
if bisou == queer:
print("bisou pour toi", bisou, amoureuxse)
elif amoureuxse == "python":
print("on dirait un.e geek")
break
else:
print(f":* :* {bisou}, {amoureuxse}")

View File

@@ -0,0 +1,12 @@
from time import sleep
love = True
how = "so"
def missing(so):
print(f"I miss you {so} much")
while love:
missing(how)
how += " so"
sleep(0.2)

View File

@@ -0,0 +1,25 @@
"""
poem converted from bash programming.sh by Winnie Soon, modified from The House of Dust, 1967 Alison Knowles and James Tenney
"""
import random
import time
# listes for different elements
kisses = ["DEAREST", "SWEETHEART", "WORLD", "DARLING", "BABY", "LOVE", "MONKEY", "SUGAR", "LITTLE PRINCE"]
material = ["SAND", "DUST", "LEAVES", "PAPER", "TIN", "ROOTS", "BRICK", "STONE", "DISCARDED CLOTHING", "GLASS", "STEEL", "PLASTIC", "MUD", "BROKEN DISHES", "WOOD", "STRAW", "WEEDS", "FOREST"]
location = ["IN A GREEN, MOSSY TERRAIN", "IN AN OVERPOPULATED AREA", "BY THE SEA", "BY AN ABANDONED LAKE", "IN A DESERTED FACTORY", "IN DENSE WOODS", "IN JAPAN", "AMONG SMALL HILLS", "IN SOUTHERN FRANCE", "AMONG HIGH MOUNTAINS", "ON AN ISLAND", "IN A COLD, WINDY CLIMATE", "IN A PLACE WITH BOTH HEAVY RAIN AND BRIGHT SUN", "IN A DESERTED AIRPORT", "IN A HOT CLIMATE", "INSIDE A MOUNTAIN", "ON THE SEA", "IN MICHIGAN", "IN HEAVY JUNGLE UNDERGROWTH", "BY A RIVER", "AMONG OTHER HOUSES", "IN A DESERTED CHURCH", "IN A METROPOLIS", "UNDERWATER", "ON THE SCREEN", "ON THE ROAD"]
light_source = ["CANDLES", "ALL AVAILABLE LIGHTING", "ELECTRICITY", "NATURAL LIGHT", "LEDS", "MOON LIGHT", "THE SMALL TORCH"]
inhabitants = ["PEOPLE WHO SLEEP VERY LITTLE", "VEGETARIANS", "HORSES AND BIRDS", "PEOPLE SPEAKING MANY LANGUAGES WEARING LITTLE OR NO CLOTHING", "CHILDREN AND OLD PEOPLE", "VARIOUS BIRDS AND FISH", "LOVERS", "PEOPLE WHO ENJOY EATING TOGETHER", "PEOPLE WHO EAT A GREAT DEAL", "COLLECTORS OF ALL TYPES", "FRIENDS AND ENEMIES", "PEOPLE WHO SLEEP ALMOST ALL THE TIME", "VERY TALL PEOPLE", "AMERICAN INDIANS", "LITTLE BOYS", "PEOPLE FROM MANY WALKS OF LIFE", "FRIENDS", "FRENCH AND GERMAN SPEAKING PEOPLE", "FISHERMEN AND FAMILIES", "PEOPLE WHO LOVE TO READ", "CHEERFUL KIDS", "QUEER LOVERS", "NAUGHTY MONKEYS", "KIDDOS"]
# Infinite loop
while True:
print("HELLO", random.choice(kisses))
print(" A TERMINAL OF BLACK", random.choice(material))
print(" ", random.choice(location))
print(" PROGRAMMING", random.choice(light_source))
print(" KISSED BY", random.choice(inhabitants))
print(" ")
# Delay for 3.5 seconds
time.sleep(3.5)

16
python/scrape/README.md Normal file
View File

@@ -0,0 +1,16 @@
## Un script qui extrait des images depuis une URL donnée
Nous devons installer:
```
pip install requests beautifulsoup4 tldextract
```
Exécutez le script avec :
```
python get_images.py https://www.freepik.com/images
```
Remplacez lURL par le lien que vous souhaitez extraire.
**Remarque:** Le scraping doit être effectué de manière éthique, en respectant les règles du fichier robots.txt et les conditions d'utilisation du site.

View File

@@ -0,0 +1,66 @@
import requests
import time
from bs4 import BeautifulSoup
from urllib.parse import urlparse
import os
import sys
import tldextract
# URL of the webpage with images
input_url = sys.argv[1]
# extract full domain
def split_domain_or_subdomain_and_path(url):
# Parse the URL
parsed_url = urlparse(url)
extracted = tldextract.extract(url)
# Build the full domain, including subdomain if present
if extracted.subdomain:
full_domain = f"{extracted.subdomain}.{extracted.domain}.{extracted.suffix}"
else:
full_domain = f"{extracted.domain}.{extracted.suffix}"
return "https://" + full_domain
full_domain = split_domain_or_subdomain_and_path(input_url)
print(f"Domain/Subdomain: {full_domain}")
# Folder to save images
save_folder = "downloaded_images"
if not os.path.exists(save_folder):
os.makedirs(save_folder)
# Send GET request to the page
response = requests.get(input_url)
if response.status_code == 200:
# Parse the HTML content with BeautifulSoup
soup = BeautifulSoup(response.text, 'html.parser')
# Find all image tags
images = soup.find_all('img')
# Loop through image tags
for idx, img in enumerate(images):
img_url = img.get('src')
# Check if img_url is complete; if not, adjust it accordingly
if not img_url.startswith("http"):
img_url = full_domain + "/" + img_url
try:
# Send request to the image URL
img_data = requests.get(img_url).content
# Define file name and path
img_name = os.path.join(save_folder, f"image_{idx}.jpg")
# Write image data to file
with open(img_name, 'wb') as handler:
handler.write(img_data)
print(f"Downloaded {img_name}")
time.sleep(1)
except Exception as e:
print(f"Failed to download {img_url}. Error: {e}")
else:
print("Failed to retrieve the page.")

0
python/script.py Normal file
View File

View File

@@ -1,31 +0,0 @@
# artistic ref : usage de python
## [Computational Poems : Les deux, Nick Montfort](https://nickm.com/2/les_deux.html)
- US digital artist / chercheur
- générateur de poème online dynamique (javascript)
- poème multilangue (fr, esp, cn) => dispositif de traduction (js)
## [The Great Netfix, *Ritasdatter & Gansing*](http://netflix.lnd4.net/)
*a video store after the end of the world*
- notion de de-clouding : proposition speculative de redistribution de la “cloub-base” contemporaine
- activité de **scraping** de film Netflix via VPN (utilitaire de deplacement immatérielle de la localisation du client) & enregistrement **VHS**
- dispositif rspi (WLAN) - tape recorder VHS
## [Videogrep, *Sam Lavigne* (2014)](https://antiboredom.github.io/videogrep/)
- python script that searches through dialog on videos and combine then in a flesh video
- e.g : condense toute les itération dune expression dune video originale
- visibilisation de normalisation dusage de stratégie marketing (element de langage) dans contexte politique -partisant-
- commande ligne tool / python module en libre acces sur archive github du project
```videogrep -- input path/to/vid.mp4 --search 'search phrase'```
## [Unerasable Characters, *Winnie Soon*](https://calls.ars.electronica.art/2023/prix/winners/7149/)
Prix Ars Electronica, 2023
- scraping data censurées/suprimées from Weibo (chinese social media == twitter)
- dispersion des ideogram dans matrice lumineuse physique
- concatenation de lensemble des caractère par machine learning (Tensor Flow) pour republication sur source (Weibo) et production dune édition physique