- check and use correct html2text

Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
HeshamTB 2020-08-21 15:45:32 +03:00
parent 850d1bc7cb
commit 3f889404d1
Signed by: Hesham
GPG Key ID: 74876157D199B09E

17
getinfo
View File

@ -19,9 +19,22 @@
# along with stonks. If not, see <https://www.gnu.org/licenses/>. # along with stonks. If not, see <https://www.gnu.org/licenses/>.
#read arg and get info from mubasher #read arg and get info from mubasher
#check requirments
html2text=html2text
if ! command -v html2text &> /dev/null
then
if ! command -v html2text2 $> /dev/null
then
echo "Can't find html2text"
exit 1
else
html2text=html2text2
fi
fi
raw=$(curl -s "https://english.mubasher.info/markets/TDWL/stocks/$1" | \ raw=$(curl -s "https://english.mubasher.info/markets/TDWL/stocks/$1" | \
html2text2 | \ $html2text | \
sed -n '/Last update:/,$p' | \ sed -n '/Last update:/,$p' | \
sed -n '/Stock Statistics/q;p') sed -n '/Stock Statistics/q;p') && echo "scrapped $1"
mkdir -p raw mkdir -p raw
echo "$raw" > "raw/$1" echo "$raw" > "raw/$1"