Giter VIP home page Giter VIP logo

Comments (2)

adn77 avatar adn77 commented on July 30, 2024

@bobMuk generally I suggest starting with the show_queue() function (-q option).
Just copy+paste one of the cURL commands.

For lists, you will want to query
/api/namedLists (shopping + to-do list)
/api/lists/linkedPartners (no idea)
/api/lists/fetchUserPreference
/api/namedLists//items (actual content of a list)

Alex

from alexa-remote-control.

bobMuk avatar bobMuk commented on July 30, 2024

Thanks. After I posted the question I did some googling of the API and stopped generally being lazy... though I am still too lazy to "officially" contribute to the project.
But if anyone wants it, I've created list functions:

-listlist
-getlist listname

Here's a diff of my changes against v0.10b of the script:

diff alexa_remote_control.sh.old alexa_remote_control.sh
101a102,103
> GETLIST=""
> LISTLIST=""
263a266,273
>               -getlist)
>                       GETLIST="true"
>                       RETRIEVELIST=$2
>                       shift
>                       ;;
>               -listlist)
>                       LISTLIST="true"
>                       ;;
747a758,786
> # list functions
> #
> list_list ()
> {
> ${CURL} ${OPTS} -s -b ${COOKIE} -A "Mozilla/5.0" -H "DNT: 1" -H "Connection: keep-alive" -L\
>  -H "Content-Type: application/json; charset=UTF-8" -H "Referer: https://alexa.${AMAZON}/spa/index.html" -H "Origin: https://alexa.${AMAZON}"\
>  -H "csrf: $(awk "\$0 ~/.${AMAZON}.*csrf[ \\s\\t]+/ {print \$7}" ${COOKIE})" -X GET \
> "https://${ALEXA}/api/namedLists" | jq '.lists[] |  .type' | sed -e 's/"//g'
> }
>
>
> get_list ()
> {
> #first get list ID from supplied name
> mylistid=$(${CURL} ${OPTS} -s -b ${COOKIE} -A "Mozilla/5.0" -H "DNT: 1" -H "Connection: keep-alive" -L  -H "Content-Type: application/json; charset=UTF-8" -H "Referer: https://alexa.${AMAZON}/spa/index.html" -H "Origin: https://alexa.${AMAZON}"  -H "csrf: $(awk "\$0 ~/.${AMAZON}.*csrf[ \\s\\t]+/ {print \$7}" ${COOKIE})" -X GET "https://${ALEXA}/api/namedLists" | jq '.lists[] | select(.type == "'$RETRIEVELIST'") | .itemId' | sed -e 's/"//g')
> if [ -z $mylistid ]
> then
>         echo "Could not identify list $RETRIEVELIST"
>         return 1
> fi
>
> #get list contents
> ${CURL} ${OPTS} -s -b ${COOKIE} -A "Mozilla/5.0" -H "DNT: 1" -H "Connection: keep-alive" -L\
>  -H "Content-Type: application/json; charset=UTF-8" -H "Referer: https://alexa.${AMAZON}/spa/index.html" -H "Origin: https://alexa.${AMAZON}"\
>  -H "csrf: $(awk "\$0 ~/.${AMAZON}.*csrf[ \\s\\t]+/ {print \$7}" ${COOKIE})" -X GET \
> "https://${ALEXA}/api/namedLists/$mylistid/items" | jq '.list[] | select(.completed ==  false) | .value' | sed -e 's/"//g'
> }
>
> #
760c799
< if [ -z "$LASTALEXA" -a -z "$BLUETOOTH" -a -z "$LEMUR" -a -z "$PLIST" -a -z "$HIST" -a -z "$SEEDID" -a -z "$ASIN" -a -z "$PRIME" -a -z "$TYPE" -a -z "$QUEUE" -a -z "$LIST" -a -z "$COMMAND" -a -z "$STATIONID" -a -z "$SONG" -a -n "$LOGOFF" ] ; then
---
> if [ -z "$LISTLIST" -a -z "$GETLIST" -a -z "$LASTALEXA" -a -z "$BLUETOOTH" -a -z "$LEMUR" -a -z "$PLIST" -a -z "$HIST" -a -z "$SEEDID" -a -z "$ASIN" -a -z "$PRIME" -a -z "$TYPE" -a -z "$QUEUE" -a -z "$LIST" -a -z "$COMMAND" -a -z "$STATIONID" -a -z "$SONG" -a -n "$LOGOFF" ] ; then
889a929,932
> elif [ -n "$GETLIST" ] ; then
>       get_list
> elif [ -n "$LISTLIST" ] ; then
>       list_list

from alexa-remote-control.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.