Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: add ratings #35

Closed
mnm1992 opened this issue Jun 12, 2017 · 18 comments
Closed

Feature request: add ratings #35

mnm1992 opened this issue Jun 12, 2017 · 18 comments

Comments

@mnm1992
Copy link

mnm1992 commented Jun 12, 2017

Can the ratings also be added to this library, like the android version?
They are a bit more complex to fetch, but very useful.
You can fetch them with the call below:
By using: GET http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=&pageNumber=0&sortOrdering=2&type=Purple+Software
With headers:
User-Agent: iTunes/9.1.1
X-Apple-Store-Front: 143441-1

X-Apple-Store-Front tells it which apple store to talk to 143441-1 is usa.
This page includes all reviews and all ratings, so it includes way more data then the rss feed and is literally the call that itunes makes.

@facundoolano
Copy link
Owner

facundoolano commented Jun 16, 2017

Sounds interesting, but I can't seem to make it work:

 curl -XGET "http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=1091944550&pageNumber=0&sortOrdering=2&type=Purple+Software" -A "iTunes/9.1.1" -H "X-Apple-Store-Front: 143441-1"

Can you show an example url to get with curl (or tell me what client you used to test it). Also it would be useful if you show an example response.

@mnm1992
Copy link
Author

mnm1992 commented Jun 16, 2017

@mnm1992
Copy link
Author

mnm1992 commented Jun 16, 2017

And an article explaining howto do it in curl: https://innumero.wordpress.com/2011/02/08/scraping-the-apple-app-store/

@facundoolano
Copy link
Owner

Still no luck, this prompts for a password, and sending an empty one as your link suggests doesn't work either.

curl -H "Host: itunes.apple.com" -H "Accept-Language: en-us, en;q=0.50" -H "X-Apple-Store-Front: 143444,5" -H "X-Apple-Tz: 3600" -U "iTunes/9.1.1" "http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=1091944550&pageNumber=0&sortOrdering=2&type=Purple+Software";

I've tried several combinations, please provide me with a command that I can paste as is to get the results.

@mnm1992
Copy link
Author

mnm1992 commented Jun 17, 2017

Weird it does work in postman(A chrome extension) and my js app(See link above).

@mnm1992
Copy link
Author

mnm1992 commented Jun 17, 2017

https://pastebin.com/NGxW3YPF
Is the output of the call, Some nice xml based webobjects.

@facundoolano
Copy link
Owner

Postman doesn't work because it doesn't allow you to override the user agent.

@mnm1992
Copy link
Author

mnm1992 commented Jun 17, 2017

It does, that's where I copy pasted the pastebin output from. It gives a warning yes, and then does it anyway

@mnm1992
Copy link
Author

mnm1992 commented Jun 17, 2017

And the postman call, that should help, just press end after importing this
iTunes.postman_collection.zip

@mnm1992
Copy link
Author

mnm1992 commented Jun 17, 2017

Btw I tried on windows and osx, mabye postman can't do useragent magic on linux

@facundoolano facundoolano changed the title Feature request Feature request: add ratings Aug 1, 2017
@mnm1992
Copy link
Author

mnm1992 commented Nov 7, 2018

Update on this, since the old way mentioned here no longer works.
If you want to integrate this feature in the future an example is here: https://www.npmjs.com/package/iosratingfetcher.

@tdunham02
Copy link

Here is the endpoint:

https://itunes.apple.com/us/customer-reviews/id529479190?dataOnly=true&displayable-kind=11

Using an iTunes user agent, it returns:

{ "adamId": 529479190, "clickToRateUrl": "https:\/\/userpub.itunes.apple.com\/WebObjects\/MZUserPublishing.woa\/wa\/userRateContent?displayable-kind=11&id=529479190", "writeUserReviewUrl": "https:\/\/userpub.itunes.apple.com\/WebObjects\/MZUserPublishing.woa\/wa\/writeUserReview?cc=us&displayable-kind=11&id=529479190", "totalNumberOfReviews": 368921, "userReviewsRowUrl": "https:\/\/itunes.apple.com\/WebObjects\/MZStore.woa\/wa\/userReviewsRow", "userReviewsSortOptions": [ { "sortId": 1, "name": "Most Helpful" }, { "sortId": 2, "name": "Most Favorable" }, { "sortId": 3, "name": "Most Critical" }, { "sortId": 4, "name": "Most Recent" } ], "kindId": 11, "kindExtId": "iosSoftware", "kindName": "software", "saveUserReviewUrl": "https:\/\/userpub.itunes.apple.com\/WebObjects\/MZUserPublishing.woa\/wa\/saveUserReview?displayable-kind=11", "ariaLabelForRatings": "4 and a half stars", "ratingCount": 2810478, "ratingCountList": [ 112419, 60634, 114882, 284207, 2238336 ], "ratingAverage": 4.5, "currentVersion": { "ariaLabelForRatings": "4 and a half stars", "ratingCount": 675780, "ratingCountList": [ 16736, 7007, 17914, 51612, 582511 ], "ratingAverage": 4.5 } }

@christian-fei
Copy link
Contributor

@facundoolano I am working on a .ratings method to add to the public API.

The method .ratings fetches the histogram and total number of ratings from the /customer-reviews endpoint like @tdunham02 suggested. It works like a charm (also by appId like in .similar).

I was thinking, to keep app-store-scraper and google-play-scraper aligned, it would be nice to include the information about the histogram in the .app method (either by default or by providing a parameter to .app), along these lines:

var store = require('app-store-scraper');

store.app({id: 553834731}).then(console.log).catch(console.log);

// or

store.app({id: 553834731, ratings: true}).then(console.log).catch(console.log);

Results:

{ id: 553834731,
  appId: 'com.midasplayer.apps.candycrushsaga',
  title: 'Candy Crush Saga',
  currentVersionScore: 4.5,
  histogram: { '1': 14, '2': 11, '3': 26, '4': 51, '5': 284 },
  ratings: 386,
  ...
}

The interesting part is that it works out of the box with the country parameter that .app accepts.

Let me know if it makes sense and have any suggestions.

Cheers,

@facundoolano
Copy link
Owner

I'm ok with that as long as the ratings request/parsing doesn't happen by default (when not explicitly requested).

@christian-fei
Copy link
Contributor

@facundoolano awesome!

will get back to you once ready and PR this stuff 🚀

Great work, life-saving :)

@christian-fei
Copy link
Contributor

PR here: #94

@christian-fei
Copy link
Contributor

@facundoolano can we close this now?

@christian-fei
Copy link
Contributor

Thank you, it was a creative discussion and pleasant PR 🤝

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants