Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
Hydra
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
Hydra
Commits
3e90a4f7
Commit
3e90a4f7
authored
Apr 18, 2025
by
PLN (Algolia)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Stars downloader
parent
bf285554
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
stars.sh
StarryNights/stars.sh
+55
-0
No files found.
StarryNights/stars.sh
0 → 100755
View file @
3e90a4f7
#!/bin/bash
# Create the image directory if it doesn't exist
mkdir
-p
img
# Base URL for the images
BASE_URL
=
"https://imagine.gsfc.nasa.gov/hst_bday/images/"
# Check if data.csv exists
if
[
!
-f
"data.csv"
]
;
then
echo
"Error: data.csv file not found!"
exit
1
fi
# Counter for downloaded images
count
=
0
total
=
$(
wc
-l
< data.csv
)
echo
"Starting download of
$total
Hubble birthday images..."
# Read each line of the CSV file
# Skip the first line if it's a header
skip_first
=
true
while
IFS
=
,
read
-r
date image_filename title description more_info year
;
do
# Skip header if needed
if
$skip_first
;
then
skip_first
=
false
continue
fi
# Extract the image filename (remove any quotes)
image_filename
=
$(
echo
"
$image_filename
"
| tr
-d
'"'
)
# Construct the full URL
url
=
"
${
BASE_URL
}${
image_filename
}
"
# Download the image with wget, showing progress
echo
"[
$((
count+1
))
/
$total
] Downloading:
$image_filename
"
wget
-q
--show-progress
-O
"img/
$image_filename
"
"
$url
"
# Check if download was successful
if
[
$?
-eq
0
]
;
then
count
=
$((
count+1
))
echo
"Downloaded: img/
$image_filename
"
else
echo
"Failed to download:
$url
"
fi
# Small delay to be nice to the server
sleep 0.5
done
< data.csv
echo
"Download complete! Successfully downloaded
$count
images."
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment