<commit_before># PlayStoreApi
This PHP library provides an unofficial Google Play Store API

## Installation
Copy the `library` folder into your project.

## Usage
First of all include the `API.php` file into your PHP script:

```php
include_once 'library/API.php';
```

Then you can create an PlayStoreApi object and configure it:

```php
$api = new PlayStoreApi();
$api->setCountryCode("ES");   // Pass a valid 2 letters ISO country code (ISO 3166 alpha-2) (default: "US")
$api->setLanguageCode("es");  // Pass a valid 2 letters ISO language code (ISO 639-1) (default: "en")
```

And last you can search for any type of data available on the Play Store:

```php
/*
* All of the following methods have the same structure
*
* @param $query string Term to search on the Google Play Store (mandatory)
* @param $page string PageToken of the page to load (if not set it'll load the first) (optional)
*/
$api->searchAlbums($query, $page);
$api->searchApps($query, $page);
$api->searchArtists($query, $page);
$api->searchBooks($query, $page);
$api->searchDevices($query, $page);
$api->searchMagazines($query, $page);
$api->searchMovies($query, $page);
$api->searchNewspapers($query, $page);
$api->searchSongs($query, $page);
$api->searchTvEpisodes($query, $page);
$api->searchTvShows($query, $page);
```

## Output
Every search method will return a json string formatted like the following:

```json
{
  "nextPageToken": "string with the pagetoken to load the next page of results",
  "items": "array of objects with variable structure depending of the type of the data searched"
}
```

The structure of every type data are the following _(all values are optional)_:

### Album

```json
{
  "album_id"
  "image"
  "title"
  "artist"
  "artist_id"
  "price"
  "url"
  "description"
  "genre"
  "tracks"
  "rating_value"
  "rating_count"
}
```

### App

```json
{
  "package"
  "icon"
  "name"
  "developer"
  "price"
  "url"
  "description"
  "category"
  "rating_value"
  "rating_count"
  "file_size"
  "date_updated"
  "num_downloads"
  "version"
  "required_android"
  "content_rating"
}
```

### Artist

```json
{
  "artist_id"
  "image"
  "name"
  "url"
  "about"
}
```

### Book

```json
{
  "book_id"
  "image"
  "title"
  "author"
  "price"
  "url"
}
```

### Device

```json
{
  "device_id"
  "image"
  "title"
  "price"
  "url"
}
```

### Magazine

```json
{
  "magazine_id"
  "image"
  "title"
  "price"
  "url"
}
```

### Movie

```json<commit_msg>Updated README with the new data of book items<commit_after># PlayStoreApi
This PHP library provides an unofficial Google Play Store API

## Installation
Copy the `library` folder into your project.

## Usage
First of all include the `API.php` file into your PHP script:

```php
include_once 'library/API.php';
```

Then you can create an PlayStoreApi object and configure it:

```php
$api = new PlayStoreApi();
$api->setCountryCode("ES");   // Pass a valid 2 letters ISO country code (ISO 3166 alpha-2) (default: "US")
$api->setLanguageCode("es");  // Pass a valid 2 letters ISO language code (ISO 639-1) (default: "en")
```

And last you can search for any type of data available on the Play Store:

```php
/*
* All of the following methods have the same structure
*
* @param $query string Term to search on the Google Play Store (mandatory)
* @param $page string PageToken of the page to load (if not set it'll load the first) (optional)
*/
$api->searchAlbums($query, $page);
$api->searchApps($query, $page);
$api->searchArtists($query, $page);
$api->searchBooks($query, $page);
$api->searchDevices($query, $page);
$api->searchMagazines($query, $page);
$api->searchMovies($query, $page);
$api->searchNewspapers($query, $page);
$api->searchSongs($query, $page);
$api->searchTvEpisodes($query, $page);
$api->searchTvShows($query, $page);
```

## Output
Every search method will return a json string formatted like the following:

```json
{
  "nextPageToken": "string with the pagetoken to load the next page of results",
  "items": "array of objects with variable structure depending of the type of the data searched"
}
```

The structure of every type data are the following _(all values are optional)_:

### Album

```json
{
  "album_id"
  "image"
  "title"
  "artist"
  "artist_id"
  "price"
  "url"
  "description"
  "genre"
  "tracks"
  "rating_value"
  "rating_count"
}
```

### App

```json
{
  "package"
  "icon"
  "name"
  "developer"
  "price"
  "url"
  "description"
  "category"
  "rating_value"
  "rating_count"
  "file_size"
  "date_updated"
  "num_downloads"
  "version"
  "required_android"
  "content_rating"
}
```

### Artist

```json
{
  "artist_id"
  "image"
  "name"
  "url"
  "about"
}
```

### Book

```json
{
  "book_id"
  "image"
  "title"
  "author"
  "price"
  "url"
  "description"
  "pages"
  "languages"
  "isbn"
  "rating_value"
  "rating_count"
}
```

### Device

```json
{
  "device_id"
  "image"
  "title"
  "price"
  "url"
}
```

### Magazine

```json
{
  "magazine_id"
  "image"
  "title"
  "price"
  "url"
}
```

### Movie

```json
{'fraction_non_alphanumeric': 0.15929908403026682, 'fraction_numerical': 0.004380724810832338, 'mean_word_length': 4.248693834900731, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6010126', 'n_tokens_mistral': 1866, 'n_tokens_neox': 1785, 'n_words': 551}