How to get apps' ranking in ios app store?
App Annie doesn't get all its data from the App Store.  According to recent stories about their funding rounds, they have hundreds of different sources of data, including:

App Store reviews
social media posts
site scraping
VPN applications
marketers
app developers and publishers
mobile advertisers and traffic managers

App Annie doesn't publicly disclose how it gets all its data.  This story states:

App Annie collects the data largely by distributing high-quality free apps, such as VPN software; it’s one of the most-downloaded such apps in the U.S. Each is free but asks for the right to collect data on apps, usage, and other behavior. Combine enough of these and you eventually get massive reach.

Developers allow the company to access their Google and Apple App Store analytic accounts in return for limited access to their data.  This allows them, and similar companies, to know and compare download and usage stats.