Skip to content

Instantly share code, notes, and snippets.

@brain90
Last active April 22, 2016 10:47
Show Gist options
  • Save brain90/8194120 to your computer and use it in GitHub Desktop.
Save brain90/8194120 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Mengunduh semua lema dari kamus kateglo
# Author: Brain90
set -vx
url='http://www.kateglo.com/?&mod=dictionary&'
# Halaman maksimum untuk tiap entri
declare -A entri
entri[a]=66 entri[b]=160 entri[c]=31 entri[d]=47 entri[e]=24 entri[f]=11
entri[g]=46 entri[h]=30 entri[i]=28 entri[j]=29 entri[k]=151 entri[l]=52
entri[m]=265 entri[n]=20 entri[o]=14 entri[p]=170 entri[q]=1 entri[r]=43
entri[s]=119 entri[t]=110 entri[u]=19 entri[v]=7 entri[w]=10 entri[x]=1
entri[y]=2 entri[z]=4
# Looping entri dari a-z
for i in "${!entri[@]}"
do
# Sedot semua lema dari halaman satu s.d halaman maksimum
halaman_maksimum=${entri[$i]}
for ((c=1; c<=$halaman_maksimum; c++))
do
wget --no-proxy -q $url'idx='$i'&p='$c -O - | grep -o 'phrase=[^""]\+' | sed -e 's/phrase=//g' >> lema.txt
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment