Skip to content

Instantly share code, notes, and snippets.

@anrylu
Last active November 14, 2018 08:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save anrylu/2ce73ff2952b10bac795c43075689251 to your computer and use it in GitHub Desktop.
Save anrylu/2ce73ff2952b10bac795c43075689251 to your computer and use it in GitHub Desktop.
MI 2018 1111 Taiwan Coupon
#!/bin/sh
# rememver to modify the COOKIE & NEXT_START_TRY_TIME
COOKIE="Enter your cookie, you can get it from chrome developer console"
NEXT_START_TRY_TIME=1541937595
NEXT_STOP_TRY_TIME=1541937605
# check time
timestamp=`date +%s`
while [ $timestamp -le $NEXT_START_TRY_TIME ]
do
timestamp=`date +%s`
echo "wait 1 seconds"
sleep 1
done
while [ 1 ]
do
# 250
echo "Try 250 ..."
curl -X GET \
'https://hd.c.mi.com/tw/eventapi/api/raffle/drawprize?tag=tw_supersalesday_page&present_id=897' \
-H 'Cache-Control: no-cache' \
-H "Cookie: $COOKIE" \
-H 'Origin: https://event.mi.com' \
-H 'Referer: https://event.mi.com/tw/sales2018/super-sales-day' &
# 100
echo "Try 100 ..."
curl -X GET \
'https://hd.c.mi.com/tw/eventapi/api/raffle/drawprize?tag=tw_supersalesday_page&present_id=896' \
-H 'Cache-Control: no-cache' \
-H "Cookie: $COOKIE" \
-H 'Origin: https://event.mi.com' \
-H 'Referer: https://event.mi.com/tw/sales2018/super-sales-day' &
wait
# check stop
timestamp=`date +%s`
if [ $timestamp -ge $NEXT_STOP_TRY_TIME ]; then
break
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment