facundoolano / app-store-scraper

scrape data from the itunes app store
MIT License
1.01k stars 240 forks source link

Apps position is not the same showed in the iTunes Store #30

Closed icaroponce closed 6 years ago

icaroponce commented 7 years ago

Hello there,

I'm using the module to search for some apps, but the result returned is not the same that I get on the iTunes app (Yes, I had set the country correctly) which works perfectly in the google-play-scraper module. As I'm using it for ASO purposes, it's critical to know the real apps positions in the iTunes. (For example, I want to know if the app which i'm optimizing in ranking better, if it's in the first position for a given word...)

Talking to a friend of mine who works with ASO daily, he told me that the iTunes API is not reliable when it comes to the apps positioning (maybe for a delay to update, idk, but it isn't the same list) and another solution would be necessary.

Had you guys have the same problems or notice something like this? Or am I the only one?

Actually, if it's really a problem, I'm considering a solution: I've found out using a Sniffer (like Wireshark), to monitor the network when I'm using the iTunes app, and the app do requests to another url, setting different headers to fetch the content to be presented on it...

Please, let me know what you guys think about it.

facundoolano commented 7 years ago

I haven't really compared both sets of search results, but if you've found differences it would definitely make sense trying to look into the actual APIs the iTunes app is using. I'd really be interested in seeing those in case you can take the time to dig around using a sniffer.

icaroponce commented 7 years ago

Sure,

here an example of url the app hits:

https://search.itunes.apple.com/WebObjects/MZSearchHints.woa/wa/hints?q=panda

Just sending a get request to it, you'll get a XML file.

You can set params to it through the header:

{"Accept-Language":"pt-br"}
{"X-Apple-Store-Front":"143503-15,32"}
{"X-Apple-I-MD-RINFO":"17106176"}
{"X-Apple-I-MD-M":"5qf7Ex9VvAxuH98/nDvbIHqW76fYyHTpVEhcWC2tBT8FKc7zqErTS9/kmJlqWXGSfPgcdl831PNkbddc"}
{"X-Apple-I-MD":"AAAABQAAABCDXFWHMZGdT6C1K2IFjB00AAAAAg=="}

These last two tokens represent language and country.

I'm quite busy this week, but if you can't check it yourself during the week, I could dig it deeper on the weekend.

But, all we need is to turn on the sniffer and watch the requests behavior to understand all the params sent on header.

I know it's a more verbose way to do it, but if really there's difference in the api, this way seems to be the most accurate way to retrieve data for some methods, like search for example.

facundoolano commented 7 years ago

Mmm the hints endpoint you show is for search hints, not search itself. That endpoint is already being used for the suggest function (see this). I imagine the search itself uses a different endpoint.

icaroponce commented 7 years ago

Ops, I'm sorry. Got the wrong endpoint.

Check it:

curl -X GET \
  'https://itunes.apple.com/WebObjects/MZStore.woa/wa/search?submit=edit&mt=1&term=pandas' \
  -H 'accept-language: en-us' \
  -H 'x-apple-i-md: AAAABQAAABASYMVHFwrAt3wPSUwbTCqGAAAAAg==' \
  -H 'x-apple-i-md-m: hxpW6pCpiMIBZ+ch0fA6Hjke7zRLyqe5KdegwA9TzU2aDGPWCL1CX85fi+s4dFX4yDC58Owm+DJImUbI' \
  -H 'x-apple-store-front: 143441-1,32 ab:IMP0' \
  -H 'x-apple-tz: -7200'

It'll return a HTML file. A bit confusing.

But, search a for a Githubissues.

  • Githubissues is a development platform for aggregating issues.