changeset 15:4391020b8ebd

Update latest bni structure
author nanaya <me@nanaya.pro>
date Fri, 08 Jun 2018 22:08:31 +0900
parents 72ee98d173a4
children 1f999668080f
files bni-update
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/bni-update	Wed Aug 03 22:49:36 2016 +0900
+++ b/bni-update	Fri Jun 08 22:08:31 2018 +0900
@@ -6,8 +6,13 @@
 PATH="${PATH}:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin"
 
 _outdir="$(dirname "${0}")"
+_outfile="bni-jpyidr.txt"
 
-curl -s http://bni.co.id/informasivalas.aspx \
-  | grep JPY \
-  | sed -e 's/[^0-9]*\([0-9][0-9.]*\)[^0-9].*/\1/' \
-  > "${_outdir}/bni-jpyidr.txt"
+curl -s http://www.bni.co.id/id-id/beranda/informasivalas \
+  | grep -F '<td class="align-center">JPY</td>' \
+  | tail -1 \
+  | sed -e 's/.*<td class="align-center">JPY<\/td><td class="align-right">\([0-9,.]*\)<\/td>.*/\1/' \
+  | sed -e 's/,/./' \
+  > "${_outdir}/${_outfile}.new"
+
+mv "${_outdir}/${_outfile}.new" "${_outdir}/${_outfile}"