Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- if [ $# -eq 0 ]; then
- cur_data=$(date --date=$(date -I) '+%s')
- else
- date_=$(echo "$2" | cut -d . -f 3)
- date_="$(echo "$2" | cut -d . -f 3)-$(echo "$2" | cut -d . -f 2)-$(echo "$2" | cut -d . -f 1)"
- echo $date_
- cur_data=$(date --date="$date_" '+%s')
- fi
- next_day=$((cur_data + 86400 - 1))
- 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[]")
- #while по страницам....
- math=$(echo "$source" | jq ".dates[] | select(.start <= \"${next_day}\" and .end >= \"${cur_data})\"")
- if [ "$math" ]; then
- 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'
- else
- echo "empty"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement