Skip to content

Commit e5c8dba

Browse files
authored
find latest date: we need to parse HTML again (#89)
1 parent da21171 commit e5c8dba

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

steps/latest_available_data.sh

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
debug() {
1010
# Comment out the following line to print debug information
11-
# echo "$@" 1>&2;
11+
# echo "$@" 1>&2
1212
echo -n ''
1313
}
1414

@@ -112,23 +112,11 @@ check_all_files_ready() {
112112
return $ANY_FILE_MISSING
113113
}
114114

115+
# Find dates in directory names. We need to parse HTML.
115116
#
116-
# Usually you might try to get a list of dates from
117-
# https://wikidata.aerotechnet.com/enwiki/ and then sort them, then look at status.html
118-
# inside the directories.
119-
#
120-
# We want to avoid parsing HTML.
121-
#
122-
# Previous version of this script then looked at index.json
123-
# (https://wikidata.aerotechnet.com/index.json) but the file is written at beginning
124-
# of the export so first of month it would list files that don't exist yet.
125-
#
126-
127-
for MINUS_NUM_MONTHS in 0 1 2 3; do
128-
set_date_to_first_of_month $MINUS_NUM_MONTHS
117+
CONTENT=$(curl -s -S --fail 'https://wikidata.aerotechnet.com/enwiki/')
118+
for DATE in $(echo $CONTENT | grep -oE '20[0-9]{6}' | sort -nr); do
129119
check_all_files_ready $DATE
130-
# echo $?
131-
# echo $RES
132120

133121
if [ $? == 0 ]; then
134122
echo "$DATE"

0 commit comments

Comments
 (0)