Browse Source

Move code to create KML files to runkml.

master
Petter Reinholdtsen 5 years ago
parent
commit
5124b1beb8
  1. 4
      runcheck
  2. 17
      runkml

4
runcheck

@ -11,7 +11,6 @@ if [ "$1" ] ; then
fi
if [ ! -d har-data ]; then mkdir har-data ; fi
if [ ! -d kml-data ]; then mkdir kml-data ; fi
cat $file | while read url ; do
case "$url" in
http*)
@ -21,11 +20,10 @@ cat $file | while read url ; do
kmlfile="kml-data/$filename.kml"
if [ ! -e "$harfile" ] ; then
echo "info: testing $url"
if phantomjs --ssl-protocol any $basedir/netsniff.js "$url" > "$harfile.new" &&
if xvfb-run phantomjs --ssl-protocol any $basedir/netsniff.js "$url" > "$harfile.new" &&
[ -s "$harfile.new" ] &&
[ "$(jq -r '.log | .entries | map(.request) | map(.url) | join("\n")' $harfile.new)" ]; then
mv "$harfile.new" "$harfile"
$basedir/har2kml "$harfile" > $kmlfile
else
echo "error: unable to handle $url"
if ! rm "$harfile.new" ; then

17
runkml

@ -0,0 +1,17 @@
#!/bin/sh
basedir="$(cd $(dirname $0); pwd)"
set -e
if [ ! -d kml-data ]; then mkdir kml-data ; fi
for harfile in "$@" ; do
filename=$(basename $harfile .har)
kmlfile="kml-data/$filename.kml"
if $basedir/har2kml "$harfile" > $kmlfile.new ; then
mv $kmlfile.new $kmlfile
else
rm $kmlfile.new
fi
done
Loading…
Cancel
Save