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

Please reduce your request rate #85

Open
hoseinmobasher opened this issue Jun 15, 2016 · 2 comments
Open

Please reduce your request rate #85

hoseinmobasher opened this issue Jun 15, 2016 · 2 comments

Comments

@hoseinmobasher
Copy link

hoseinmobasher commented Jun 15, 2016

Hello,
I have an issue on crawling apps. After some tests, Google says "Please reduce your request rate" and return 429 status code. How should I do? Could you please guide me to solve my problem?

Exception in thread "main" com.akdeniz.googleplaycrawler.GooglePlayException:

429 Too Many Requests

Please reduce your request rate.

at com.akdeniz.googleplaycrawler.GooglePlayAPI.executeHttpRequest(GooglePlayAPI.java:526)
at com.akdeniz.googleplaycrawler.GooglePlayAPI.executeGet(GooglePlayAPI.java:515)
at com.akdeniz.googleplaycrawler.GooglePlayAPI.executeGETRequest(GooglePlayAPI.java:419)
at com.akdeniz.googleplaycrawler.GooglePlayAPI.list(GooglePlayAPI.java:303)
at hossein.GooglePlayCrawler.main(GooglePlayCrawler.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

The snippet I used is:

    GooglePlayAPI api = new GooglePlayAPI("[email protected]", "password", "android-id");
    api.setClient(new DefaultHttpClient(GooglePlayAPI.getConnectionManager()));
    api.login();

    FileWriter appWriter = new FileWriter(new File("/Users/hossein/Desktop/Dataset/GP", "apps.txt"));
    FileWriter revWriter = new FileWriter(new File("/Users/hossein/Desktop/Dataset/GP", "reviews.txt"));

    for (int appIndex = 0; appIndex < 5000; appIndex += 100) {
        ListResponse listResponse = api.list("SPORTS", "apps_topselling_free", appIndex, 100);
        List<DocV2> apps = listResponse.getDoc(0).getChildList();

        for (DocV2 app : apps) {
            AppDetails appDetail = app.getDetails().getAppDetails();
            appWriter.write(String.format("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%d\n",
                    appDetail.getPackageName(), appDetail.getTitle(), appDetail.getAppType(), appDetail.getDeveloperName(),
                    appDetail.getNumDownloads(), appDetail.getVersionString(), appDetail.getUploadDate(), appDetail.getContentRating()));
            System.out.println("Processing: " + appDetail.getPackageName());
            for (int reviewIndex = 0; reviewIndex < 500; reviewIndex += 20) {
                ReviewResponse review = api.reviews(appDetail.getPackageName(), GooglePlayAPI.REVIEW_SORT.HELPFUL, reviewIndex, 20);
                List<Review> reviews = review.getGetResponse().getReviewList();

                for (Review r : reviews) {
                    revWriter.write(String.format("%s\t%s\t%s\t%s\t%s\t%d\t%d\t%s\n",
                            appDetail.getPackageName(), r.getAuthorName(), r.getTitle(), r.getComment(),
                            r.getDeviceName(), r.getStarRating(), r.getTimestampMsec(), r.getUrl()));
                }
            }
        }
    }

    appWriter.close();
    revWriter.close();
@WadeaHijjawi
Copy link

I have the same error, any solution for this problem?

@Fuzion24
Copy link
Contributor

Fuzion24 commented Oct 6, 2017

You could either slow the requests down or use multiple accounts.

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

No branches or pull requests

3 participants