forked from raycast/script-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfear-index.sh
executable file
·30 lines (23 loc) · 1.09 KB
/
fear-index.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Fear Index
# @raycast.mode inline
# @raycast.refreshTime 12h
# Optional parameters:
# @raycast.packageName Fear & Greed Index
# @raycast.icon 😱
# Documentation:
# @raycast.description Fear & Greed Index from CNN
# @raycast.author Astrit
# @raycast.authorURL https://github.com/astrit
url="https://money.cnn.com/data/fear-and-greed/"
result=$(curl -s $url )
result=$(echo "$result" | sed -e 's/(Fear)/↓/g')
result=$(echo "$result" | sed -e 's/(Greed)/↑/g')
greedNow=$(echo "$result" | sed -n -e 's/.*<li>Fear & Greed Now: *\([^<]*\).*/\1/p')
greedPrevious=$(echo "$result" | sed -n -e 's/.*<li>Fear & Greed Previous Close: *\([^<]*\).*/\1/p')
greedWeek=$(echo "$result" | sed -n -e 's/.*<li>Fear & Greed 1 Week Ago: *\([^<]*\).*/\1/p')
greedMonth=$(echo "$result" | sed -n -e 's/.*<li>Fear & Greed 1 Month Ago: *\([^<]*\).*/\1/p')
greedYear=$(echo "$result" | sed -n -e 's/.*<li>Fear & Greed 1 Year Ago: *\([^<]*\).*/\1/p')
echo "H:$greedNow D:$greedPrevious W:$greedWeek M:$greedMonth Y:$greedYear"