appstore-sensor
Advanced tools
Comparing version 0.5.0 to 0.5.1
{ | ||
"name": "appstore-sensor", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Apple AppStore application, reviews and ratings fetcher for Node.js", | ||
@@ -32,2 +32,3 @@ "author": "Yagiz Nizipli <yagiz@nizipli.com>", | ||
"dependencies": { | ||
"fast-xml-parser": "^3.19.0", | ||
"got": "^11.8.2", | ||
@@ -34,0 +35,0 @@ "iso-3166-1": "^2.0.1" |
<h1 align="center">Welcome to Appstore Sensor 👋</h1> | ||
<p> | ||
<img alt="Version" src="https://img.shields.io/badge/version-0.5.0-blue.svg?cacheSeconds=2592000" /> | ||
<img alt="Version" src="https://img.shields.io/badge/version-0.5.1-blue.svg?cacheSeconds=2592000" /> | ||
<img src="https://img.shields.io/badge/node-%3E%3D15.0.0-blue.svg" /> | ||
@@ -43,6 +43,6 @@ <a href='https://coveralls.io/github/socketkit/appstore-sensor?branch=main'> | ||
* Website: https://socketkit.com | ||
* Twitter: [@yagiznizipli](https://twitter.com/socketkitcom) | ||
* Github: [@socketkit](https://github.com/socketkit) | ||
* LinkedIn: [@yagiznizipli](https://linkedin.com/in/yagiznizipli) | ||
- Website: https://socketkit.com | ||
- Twitter: [@yagiznizipli](https://twitter.com/socketkitcom) | ||
- Github: [@socketkit](https://github.com/socketkit) | ||
- LinkedIn: [@yagiznizipli](https://linkedin.com/in/yagiznizipli) | ||
@@ -49,0 +49,0 @@ ## 🤝 Contributing |
@@ -45,10 +45,12 @@ import { ensureArray } from './helper.js' | ||
id: review.id.label, | ||
userName: review.author.name.label, | ||
userUrl: review.author.uri.label, | ||
version: review['im:version'].label, | ||
score: parseInt(review['im:rating'].label), | ||
title: review.title.label, | ||
text: review.content.label, | ||
url: review.link.attributes.href, | ||
userName: review.author.name, | ||
userUrl: review.author.uri, | ||
version: review['im:version'], | ||
score: parseInt(review['im:rating']), | ||
title: review.title, | ||
text: review.content.find((c) => c.type === 'text'), | ||
html: review.content.find((c) => c.type === 'html'), | ||
url: review.link.href, | ||
updatedAt: review.updated, | ||
})) | ||
} |
import got from 'got' | ||
import iso from 'iso-3166-1' | ||
import parser from 'fast-xml-parser' | ||
import { sort } from './library/fixtures.js' | ||
import { reviewList } from './library/normalize.js' | ||
/** | ||
@@ -34,3 +35,5 @@ * @param {Object} param0 | ||
throw new Error( | ||
`Invalid sort field. Proper fields are ${Object.values(sort).join(', ')}.`, | ||
`Invalid sort field. Proper fields are ${Object.values(sort).join( | ||
', ', | ||
)}.`, | ||
) | ||
@@ -40,6 +43,5 @@ } | ||
const { body } = await got( | ||
`https://itunes.apple.com/${iso_normalized.alpha2}/rss/customerreviews/page=${page}/id=${id}/sortby=${sort_by}/json`, | ||
`https://itunes.apple.com/${iso_normalized.alpha2}/rss/customerreviews/page=${page}/id=${id}/sortby=${sort_by}/xml`, | ||
{ | ||
method: 'GET', | ||
responseType: 'json', | ||
...options, | ||
@@ -49,3 +51,27 @@ }, | ||
return reviewList(body) | ||
try { | ||
const parsed = parser.parse( | ||
body, | ||
{ | ||
attributeNamePrefix: '', | ||
trimValues: true, | ||
parseNodeValue: true, | ||
parseAttributeValue: false, | ||
textNodeName: 'text', | ||
ignoreAttributes: false, | ||
ignoreNameSpace: false, | ||
format: false, | ||
supressEmptyNode: true, | ||
arrayMode: false, | ||
}, | ||
true, | ||
) | ||
return reviewList(parsed) | ||
} catch (error) { | ||
throw new Error( | ||
'XML validation failed on review response from AppStore', | ||
error.message, | ||
) | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
198908
35
959
3
1
+ Addedfast-xml-parser@^3.19.0
+ Addedfast-xml-parser@3.21.1(transitive)
+ Addedstrnum@1.0.5(transitive)