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

Scrap discounted games and games with pre-registration #652

Open
jbigman opened this issue Aug 7, 2023 · 0 comments
Open

Scrap discounted games and games with pre-registration #652

jbigman opened this issue Aug 7, 2023 · 0 comments

Comments

@jbigman
Copy link
Contributor

jbigman commented Aug 7, 2023

Description:

I need to scrap play store to retrieve discounted games and games with pre-registration

3 solutions

  • improve this library with games.js
  • export utils methods in index.d.ts to allow play store scrapping from external code with custom urls
  • do nothing ^^

Improve this library with game search methods

Urls we can use:

const topsellingGames = 'https://play.google.com/store/apps/collection/topselling_free?clp=ChcKFQoPdG9wc2VsbGluZ19mcmVlEAcYAw%3D%3D:S:ANO1ljLwMrI&gsr=ChkKFwoVCg90b3BzZWxsaW5nX2ZyZWUQBxgD:S:ANO1ljIxP20';
const popularGames = '/store/apps/collection/promotion_30009c9_row_popular_games?clp=CisKKQojcHJvbW90aW9uXzMwMDA5Yzlfcm93X3BvcHVsYXJfZ2FtZXMQShgD:S:ANO1ljJKGaU&gsr=Ci0KKwopCiNwcm9tb3Rpb25fMzAwMDljOV9yb3dfcG9wdWxhcl9nYW1lcxBKGAM%3D:S:ANO1ljIJdN4';
const freeGames = '/store/apps/collection/promotion_300201f_top_selling_free_games?clp=CjAKLgoocHJvbW90aW9uXzMwMDIwMWZfdG9wX3NlbGxpbmdfZnJlZV9nYW1lcxBKGAM%3D:S:ANO1ljJaWqI&gsr=CjIKMAouCihwcm9tb3Rpb25fMzAwMjAxZl90b3Bfc2VsbGluZ19mcmVlX2dhbWVzEEoYAw%3D%3D:S:ANO1ljJERt0';
const discountGames = '/store/apps/collection/promotion_3002c9b_gamesDynamic_cyberweek2017?clp=CjQKMgoscHJvbW90aW9uXzMwMDJjOWJfZ2FtZXNEeW5hbWljX2N5YmVyd2VlazIwMTcQShgD:S:ANO1ljI2ADA&gsr=CjYKNAoyCixwcm9tb3Rpb25fMzAwMmM5Yl9nYW1lc0R5bmFtaWNfY3liZXJ3ZWVrMjAxNxBKGAM%3D:S:ANO1ljK6Aoo';
const preRegistrationGames = '/store/apps/collection/promotion_3000000d51_pre_registration_games';

Implementation

Exemple available in my game-improv branch : https://github.com/jbigman/google-play-scraper/blob/game-improv/lib/games.js
(Almost a duplicate of search.js. Some refactoring would be great because most files share the same structure/pattern)

interface IOptions {
    requestOptions?: any,
    lang?: string,
    country?: string,
    throttle?: any,
    filter?: 'FREE' | 'NEW' | 'PREREGISTER' | "DISCOUNT" | 'POPULAR' | 'TOPSELLINGS',
    fullDetail?: boolean,
    num?: number,
    cache?: any
}
const games = async (opts: IOptions): Promise<IAppItemFullDetail[]> => {}

Add utils method to the index.d.ts file

// constants
export const BASE_URL = 'https://play.google.com';

// Utils
export const request: (opts, limit) => Promise<any>
export const scriptData: {
  parse: (response) => any,
  parseServiceRequests: (response) => any,
  extractor: (mappings) => any,
  extractDataWithServiceRequestId: (parsedData, spec) => any
}
export const processFullDetailApps: (apps, opts) => Promise<IAppItemFullDetail[]>
export const checkFinished: (opts, savedApps, nextToken) => any

Do nothing

Document in readme how Typescript users have to extend module interface if they need it

import "google-play-scraper"; // Trigger declaration merging

declare module "google-play-scraper" {
    // constants
    export const BASE_URL = 'https://play.google.com';

    // Utils
    export const request: (opts, limit) => Promise<any>;
    export const scriptData: {
        parse: (response) => any,
        parseServiceRequests: (response) => any,
        extractor: (mappings) => any,
        extractDataWithServiceRequestId: (parsedData, spec) => any
    };
    export const processFullDetailApps: (apps, opts) => Promise<IAppItemFullDetail[]>;
    export const checkFinished: (opts, savedApps, nextToken) => any;
}

What's the best thing to do ?

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

1 participant