Sending JSON errors to /dev/null
This commit is contained in:
parent
93e6b35570
commit
91521c5ebd
20
taste/taste
20
taste/taste
|
@ -92,17 +92,17 @@ getSimilar()
|
||||||
export PYTHONIOENCODING=utf8 #necessary for python in some cases
|
export PYTHONIOENCODING=utf8 #necessary for python in some cases
|
||||||
media=$( echo "$1 $2 $3 $4 $5 $6 $7 $8" | tr " " + )
|
media=$( echo "$1 $2 $3 $4 $5 $6 $7 $8" | tr " " + )
|
||||||
response=$(httpGet "https://tastedive.com/api/similar?q=$media&k=$apiKey&info=$info")
|
response=$(httpGet "https://tastedive.com/api/similar?q=$media&k=$apiKey&info=$info")
|
||||||
nameOne=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['Name']" || { echo "Error: Did you search a valid item?"; return 1; } )
|
nameOne=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['Name']" 2> /dev/null || { echo "Error: Did you search a valid item?"; return 1; } )
|
||||||
typeOne=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['Type']")
|
typeOne=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['Type']" 2> /dev/null)
|
||||||
nameTwo=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][1]['Name']")
|
nameTwo=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][1]['Name']" 2> /dev/null)
|
||||||
typeTwo=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][1]['Type']")
|
typeTwo=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][1]['Type']" 2> /dev/null)
|
||||||
nameThree=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][2]['Name']")
|
nameThree=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][2]['Name']" 2> /dev/null)
|
||||||
typeThree=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][2]['Type']")
|
typeThree=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][2]['Type']" 2> /dev/null)
|
||||||
if [[ $info == "1" ]];then
|
if [[ $info == "1" ]];then
|
||||||
wikiOne=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['wTeaser']")
|
wikiOne=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['wTeaser']" 2> /dev/null)
|
||||||
wikiTwo=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][1]['wTeaser']")
|
wikiTwo=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][1]['wTeaser']" 2> /dev/null)
|
||||||
wikiThree=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][2]['wTeaser']")
|
wikiThree=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][2]['wTeaser']" 2> /dev/null)
|
||||||
youtube=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['yUrl']")
|
youtube=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['yUrl']" 2> /dev/null)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue