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

Fixes #13: App details endpoint #14

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 111 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
This library is able to fetch and parse data from undocumented internal API endpoints of the Google Play Store. Currently, it has the following features:

* Fetch the **charts of the most popular apps**, including filtering by category and chart.
* Fetch apps' **data safety labels**.
* Fetch an app's **metadata** including **data safety labels**.
* **Search** for apps.

I'll extend the supported API endpoints over time, as per what I need for my projects. The focus will likely be on functions useful for research into mobile privacy and data protection.
Expand Down Expand Up @@ -66,62 +66,72 @@ console.log(topCharts[1]?.[0]?.app_id, topCharts?.[1]?.[0]?.name); // com.MOBGam

Note that despite us trying to fetch 1000 apps for the second chart, only 660 apps were returned. This is a server-side limit.

### Fetch an app's data safety labels
### Fetch app details

The following example fetches the data safety labels for TikTok in English:
The following example fetches the metadata of the Facebook app:

```ts
import { fetchDataSafetyLabels } from 'parse-play';
import { fetchAppDetails } from 'parse-play';

(async () => {
const labels = await fetchDataSafetyLabels([{ app_id: 'com.zhiliaoapp.musically' }], { language: 'EN', });
console.dir(labels, { depth: null });
const appDetails = await fetchAppDetails({ appId: 'com.facebook.katana' }, { language: 'EN', country: 'DE' });
console.log(appDetails.name, 'costs', appDetails.price, 'and was last updated on', appDetails.updated_on);
// Facebook costs €0.00 and was last updated on 2024-06-13T04:58:13.000Z
})();
```

Through this endpoint, you can also fetch an app's data safety labels:

```ts
const appDetails = await fetchAppDetails({ appId: 'com.facebook.katana' }, { language: 'EN', country: 'DE' });

console.log('Data shared:', appDetails.data_shared);
console.log('Data collected:', appDetails.data_collected);
console.log('Security practices:', appDetails.security_practices);
console.log('Privacy policy URL:', appDetails.privacy_policy_url);
```

<details>
<summary>Data safety label response</summary>
The response looks like this:
The result looks like this:

```ts
{
name: 'TikTok',
app_id: 'com.zhiliaoapp.musically',
developer: {
name: 'TikTok Pte. Ltd.',
path: '/store/apps/developer?id=TikTok+Pte.+Ltd.',
website_url: 'https://www.tiktok.com/',
email: 'feedback@tiktok.com',
address: '201 Henderson Road,\n#06-22 Apex@Henderson,\nSingapore 159545 Singapore'
```
Data shared: [
{
category: 'Personal info',
type: 'Name',
purposes: [ 'Fraud prevention, security, and compliance' ],
optional: false
},
icon_url: 'https://play-lh.googleusercontent.com/iBYjvYuNq8BB7EEEHktPG1fpX9NiY7Jcyg1iRtQxO442r9CZ8H-X9cLkTjpbORwWDG9d',
privacy_policy_url: 'https://www.tiktok.com/legal/privacy-policy',
data_shared: [],
data_collected: [
{
category: 'Location',
type: 'Approximate location',
purposes: [
'App functionality',
'Analytics',
'Advertising or marketing',
'Personalization'
]
},
// …
],
security_practices: {
data_encrypted_in_transit: true,
can_request_data_deletion: true,
committed_to_play_families_policy: undefined,
independent_security_review: undefined
}
// …
]
Data collected: [
{
category: 'Personal info',
type: 'Name',
purposes: [
'App functionality',
'Analytics',
'Developer communications',
'Advertising or marketing',
'Fraud prevention, security, and compliance',
'Personalization',
'Account management'
],
optional: false
},
// …
]
Security practices: {
data_encrypted_in_transit: true,
can_request_data_deletion: true,
committed_to_play_families_policy: undefined,
independent_security_review: undefined
}
Privacy policy URL: https://www.facebook.com/about/privacy/
```
</details>

You can also request the labels for multiple apps at once by adding corresponding objects to the first parameter, they will all be fetched in a single API request.

### Search for apps

The following example searches for the term "education":
Expand Down Expand Up @@ -171,6 +181,66 @@ The response looks like this:
```
</details>

### Fetch an app's data safety labels

> [!WARNING]
> The separate function for fetching data safety labels is deprecated and will be removed in a future release. Instead, you can use [fetch an app's metadata](#fetch-app-details), which includes the data safety label.

The following example fetches the data safety labels for TikTok in English:

```ts
import { fetchDataSafetyLabels } from 'parse-play';

(async () => {
const labels = await fetchDataSafetyLabels([{ app_id: 'com.zhiliaoapp.musically' }], { language: 'EN', });
console.dir(labels, { depth: null });
})();
```

<details>
<summary>Data safety label response</summary>
The response looks like this:

```ts
{
name: 'TikTok',
app_id: 'com.zhiliaoapp.musically',
developer: {
name: 'TikTok Pte. Ltd.',
path: '/store/apps/developer?id=TikTok+Pte.+Ltd.',
website_url: 'https://www.tiktok.com/',
email: 'feedback@tiktok.com',
address: '201 Henderson Road,\n#06-22 Apex@Henderson,\nSingapore 159545 Singapore'
},
icon_url: 'https://play-lh.googleusercontent.com/iBYjvYuNq8BB7EEEHktPG1fpX9NiY7Jcyg1iRtQxO442r9CZ8H-X9cLkTjpbORwWDG9d',
privacy_policy_url: 'https://www.tiktok.com/legal/privacy-policy',
data_shared: [],
data_collected: [
{
category: 'Location',
type: 'Approximate location',
purposes: [
'App functionality',
'Analytics',
'Advertising or marketing',
'Personalization'
]
},
// …
],
security_practices: {
data_encrypted_in_transit: true,
can_request_data_deletion: true,
committed_to_play_families_policy: undefined,
independent_security_review: undefined
}
}
```
</details>

You can also request the labels for multiple apps at once by adding corresponding objects to the first parameter, they will all be fetched in a single API request.


## License

parse-play is licensed under the MIT license, see the [`LICENSE`](/LICENSE) file for details.
Expand Down
Loading