Giter Club home page Giter Club logo

canigethome's Introduction

CanIGetHome? - Get uber prices

The main idea is the possibility to me to get the estimate uber rides prices through my mi band 6.

  • Get my current localization
  • Use something to automatize the action with just two clicks (Destination, get prices)
  • Return me through notification all ride price options from uber app
  • Write a quickly resume how to use
  • Publish writing and repository

Well, how the hell you did that?

Firstly, you should know the mi band 6 don’t make all work, actually my phone and an API made by me do all work.

Ok… Right… The first question I had when I decided to do this automatization it’s how can I get uber ride estimate from a place to another place. Like, how can I access this info? How can I pass my localization pickup and where I wish drop off? And there I thought about web scraping to do that work. Ok, I’m lying if I told you it was my first thought. Actually I was searching about Uber API and I didn’t find anything very clear. So when I was sad about the idea, I thought to made a web scraping.

With a web scraping you can build any application you want. So I decided to look some Uber web application requests usually do and it was there where I found the sweet route called “graphql” who made requests sending my pick up localization and my drop off localization with an authentication cookie. Well, if I can do this request from an API that means I can do what I wish to do. Great no?

Above follow the images about the route

Payload:

image1

Response

image2

Of course I send some info besides that above, like my authentication cookie inside headers but I don’t want to show it for you 🥵. You know 😏, I’m dumb but not so.

WELLL. So as you see some values its returned inside an object called fares, inside fareEstimates. After made some analysis I discovered that the code attributes inside fares object is a different way to identify Uber rides types. So I discovered it

20022265 = comfort
20027725 = uberx
20034913 = motocycle

And as you can see inside the code object has your related prices:

image3

All right. If I can get this data from my API that means I do the hard work. And I did it and I built an API that have a get prices route receiving two main parameters: pickup coordinates and drop off coordinates.

After built the API the next step its to configure my phone to make some requests and generate notifications from this requests. For that I used an app called “MacroDroid” to do all my stuffs on my phone. There I made a macro configured to do all I want to show uber prices through my mi band.

THE MACROGOD

image

Well as you can see my macro do the follow steps:

  • The trigger happens when I enable the silent mode from my phone when he it's on my bag (for this case your proximity sensor its near, that means that I’m not with my phone in my hand, making the feature useful yet when I want to put silent mode on my phone, because he it's in my hand and not into my bag).
  • When the trigger is fired my macro get my current localization.
  • Make a http request with method GET to my API passing my current localization and drop off localization that I put into a variable inside the app
  • Wait three seconds
  • And make notification to show on my mi band 6.

RESULT

image

Video showing how it works. https://youtu.be/y8t5UT-AN6E

That's all, folks 🐷.

canigethome's People

Contributors

emerson1337 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.