Table of Contents
Why climb Mobike’s data
Where to get the data
After climbing data for several days in a row, I analyzed the data and found that the GPS of Mobike seemed to be beating all the time, and sometimes the beat would exceed a distance of several kilometers. , obviously not a normal value.
turnaround
Other attempts
Also talk about API design
Home Backend Development Python Tutorial Mobike crawler analysis - find the API

Mobike crawler analysis - find the API

Apr 04, 2017 am 10:37 AM
api Mobike

Warning: This article is only for reference purposes for learning and research, please do not use it for illegal purposes.

In the previous article "Mobike Unofficial Big Data Analysis" I mentioned my data analysis of Mobike during the Spring Festival. I will further elaborate on it in the following series of articles. How does my crawler crawl this data efficiently?

Why climb Mobike’s data

Mobike is the first shared bicycle to enter Chengdu. Every day when I get off the subway station, I can see many bicycles in the APP, but when I walk there When I arrived, I realized the car was not there. Some cars are hidden somewhere; some cars may be behind high-rise buildings and cannot be found due to GPS errors; some cars are placed in residential areas, separated by a wall so that cyclists cannot get to them.

So is there a way to obtain the data of these bicycles to analyze whether these bicycles have become zombie bicycles? Did someone deliberately put it in the community so that no one can access it?

With these questions, I began to study how to obtain this data.

Where to get the data

If you can see the data, then we always have a way to automatically obtain the data. It’s just that the method of obtaining data determines the efficiency of obtaining data. For the task of data analysis of Mobike, the crawler must be able to obtain more data in a short time (usually about 10 minutes). For data Analysis is useful. So where does the data come from?

The most direct source is the Mobike APP. Modern software design pays attention to the separation of front-end and back-end, and the server will serve APP, web pages, etc. at the same time. Under this trend, we only need to figure out the HTTP request of the software. Generally speaking, the following tools can help:

Direct packet capture:

##Use a proxy to capture HTTP request packets and

debug :

  • Fid

    dler 4

  • Charles

  • Packet Capture (Android)

Since my phone is not rooted, there is too much interference in capturing packets on the router, and it is not easy to use https. So you can only try using Fiddler or Charles first. Hang up Fiddler's proxy, and then keep moving the location on the mobile phone to see if there are any new requests. But unfortunately, it seems that the requests are all for getting the Amap

map, and there is no data related to Mobike.

What's going on? Try the mobile version. After switching to Packet Capture, there was indeed traffic, and I found the one I was most concerned about in the request:

Mobike crawler analysis - find the API
##4372317-de272f8395d2106f.png

This

API

The request is obvious at first glance. I tried it in postman and it can return the information correctly. It seems that it is you! too happy too early

After climbing data for several days in a row, I analyzed the data and found that the GPS of Mobike seemed to be beating all the time, and sometimes the beat would exceed a distance of several kilometers. , obviously not a normal value.

Could it be that their

interface

has been manipulated to return false data? I observed that even in the APP, the data returned by the bicycle jumped. From early one morning to the next morning, I refreshed the cars near my home at intervals to see if this was really the case.

Picture

I can’t find it, but after observation, I came to the conclusion that there is indeed a problem with the location returned in the APP. There was a car placed in a very remote location. It disappeared for a while, then came back later, and it matched the data I captured. Moreover, this bounce has nothing to do with mobile phones, mobile phone numbers, or even mobile operators, which shows that this bounce is a problem with Mobike’s interface. It can also explain from another aspect why we sometimes see cars but there are actually no cars there. This is a screenshot of a

video

posted on Moments before. You can see that there is a sharp point near the entrance of the camp. The car is actually stopped there, but the GPS track shows that it is for a short time. The inner body moves nearby, even moves far away, and then returns to that position.

Mobike crawler analysis - find the API

## Such data is simply useless for data analysis, and I almost gave up.

turnaround

With the popularity of the WeChat mini program, Mobike also launched the mini program immediately. I laughed when I saw it, yes, it gave me another data source to try. After capturing data once with Packet Capture, it is easy to determine the API. The specific process will not be explained here. After crawling, I crawled two or three days of data and found that there was a turnaround, and the data was consistent with normal bicycle trajectories.

The only thing left is to improve the efficiency of the crawler.

Other attempts

Sometimes it is very convenient to directly analyze the source code of the APP to find the API entrance. I decompile the Mobike Android APP, but I find that except for some resource files, it is useful. , other files are packed using Qihoo 360's obfuscator. There are articles on the Internet that analyze how to perform shelling, but I don’t have much time to study it, so forget it.

Also talk about API design

The reason why Mobike’s API is easy to crawl and analyze is largely because the API design is too simple:

  • Only uses http requests, making it easy to carry out packet capture analysis

  • There is no encryption of requests in these APIs, making their services easy to be use.

  • In addition, WeChat mini programs are also an important source of leaked APIs. After all, requests in the APP can be encrypted through native code and then sent out, but there does not seem to be such a method in mini programs. Function.

If you are interested, you can try to take a look at the request of Xiaolan Bicycle APP. They use https request and encrypt the data request. It is difficult to capture their data. It will increase a lot.

Of course, if Mobike officials don’t care about data, such an API design would be OK.


The above is the detailed content of Mobike crawler analysis - find the API. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP and Manticore Search Development Guide: Quickly Create a Search API PHP and Manticore Search Development Guide: Quickly Create a Search API Aug 07, 2023 pm 06:05 PM

PHP and ManticoreSearch Development Guide: Quickly Create a Search API Search is one of the indispensable features in modern web applications. Whether it is an e-commerce website, social media platform or news portal, it needs to provide an efficient and accurate search function to help users find the content they are interested in. As a full-text search engine with excellent performance, ManticoreSearch provides us with a powerful tool to create excellent search APIs. This article will show you how to

How to crawl and process data by calling API interface in PHP project? How to crawl and process data by calling API interface in PHP project? Sep 05, 2023 am 08:41 AM

How to crawl and process data by calling API interface in PHP project? 1. Introduction In PHP projects, we often need to crawl data from other websites and process these data. Many websites provide API interfaces, and we can obtain data by calling these interfaces. This article will introduce how to use PHP to call the API interface to crawl and process data. 2. Obtain the URL and parameters of the API interface. Before starting, we need to obtain the URL of the target API interface and the required parameters.

How to deal with Laravel API error problems How to deal with Laravel API error problems Mar 06, 2024 pm 05:18 PM

Title: How to deal with Laravel API error problems, specific code examples are needed. When developing Laravel, API errors are often encountered. These errors may come from various reasons such as program code logic errors, database query problems, or external API request failures. How to handle these error reports is a key issue. This article will use specific code examples to demonstrate how to effectively handle Laravel API error reports. 1. Error handling in Laravel

Save API data to CSV format using Python Save API data to CSV format using Python Aug 31, 2023 pm 09:09 PM

In the world of data-driven applications and analytics, APIs (Application Programming Interfaces) play a vital role in retrieving data from various sources. When working with API data, you often need to store the data in a format that is easy to access and manipulate. One such format is CSV (Comma Separated Values), which allows tabular data to be organized and stored efficiently. This article will explore the process of saving API data to CSV format using the powerful programming language Python. By following the steps outlined in this guide, we will learn how to retrieve data from the API, extract relevant information, and store it in a CSV file for further analysis and processing. Let’s dive into the world of API data processing with Python and unlock the potential of the CSV format

React API Call Guide: How to interact and transfer data with the backend API React API Call Guide: How to interact and transfer data with the backend API Sep 26, 2023 am 10:19 AM

ReactAPI Call Guide: How to interact with and transfer data to the backend API Overview: In modern web development, interacting with and transferring data to the backend API is a common need. React, as a popular front-end framework, provides some powerful tools and features to simplify this process. This article will introduce how to use React to call the backend API, including basic GET and POST requests, and provide specific code examples. Install the required dependencies: First, make sure Axi is installed in the project

Oracle API Usage Guide: Exploring Data Interface Technology Oracle API Usage Guide: Exploring Data Interface Technology Mar 07, 2024 am 11:12 AM

Oracle is a world-renowned database management system provider, and its API (Application Programming Interface) is a powerful tool that helps developers easily interact and integrate with Oracle databases. In this article, we will delve into the Oracle API usage guide, show readers how to utilize data interface technology during the development process, and provide specific code examples. 1.Oracle

Oracle API integration strategy analysis: achieving seamless communication between systems Oracle API integration strategy analysis: achieving seamless communication between systems Mar 07, 2024 pm 10:09 PM

OracleAPI integration strategy analysis: To achieve seamless communication between systems, specific code examples are required. In today's digital era, internal enterprise systems need to communicate with each other and share data, and OracleAPI is one of the important tools to help achieve seamless communication between systems. This article will start with the basic concepts and principles of OracleAPI, explore API integration strategies, and finally give specific code examples to help readers better understand and apply OracleAPI. 1. Basic Oracle API

How to develop a simple CRUD API using MongoDB How to develop a simple CRUD API using MongoDB Sep 19, 2023 pm 12:32 PM

How to use MongoDB to develop a simple CRUD API In modern web application development, CRUD (Create, Delete, Modify, Check) operations are one of the most common and important functions. In this article, we will introduce how to develop a simple CRUD API using MongoDB database and provide specific code examples. MongoDB is an open source NoSQL database that stores data in the form of documents. Unlike traditional relational databases, MongoDB does not have a predefined schema

See all articles