Advertisement
kolbka_

Untitled

Mar 15th, 2022
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.94 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. if [ $# -eq 0 ]; then
  3.   cur_data=$(date --date=$(date -I) '+%s')
  4. else
  5.   date_=$(echo "$2" | cut -d . -f 3)
  6.   date_="$(echo "$2" | cut -d . -f 3)-$(echo "$2" | cut -d . -f 2)-$(echo "$2" | cut -d . -f 1)"
  7.   echo $date_
  8.   cur_data=$(date --date="$date_" '+%s')
  9. fi
  10. next_day=$((cur_data + 86400 - 1))
  11.  
  12. source=$(curl -s -L "https://kudago.com/public-api/v1.4/events/?lang=&fields=title,dates,place,description,age_restriction,price&order_by=&actual_since=$cur_data&text_format=&ids=&location=&is_free=&lon=&lat=&radius=&expand=place" | jq ".results[]")
  13. #while по страницам....
  14. math=$(echo "$source" | jq ".dates[] | select(.start <= \"${next_day}\" and .end >= \"${cur_data})\"")
  15. if [ "$math" ]; then
  16.   echo "$source" | jq  ". | select(.title | contains(\"${1}\"))" | jq -r '.title, .place.title, .dates[0].start, .place.title, .description, .age_restriction, .price' | sed -e 's/null/-/g'
  17.  
  18.   else
  19.   echo "empty"
  20.   fi
  21.  
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement