Usage of Deprecated Dependency
- Operating System: W10
- Node version: 17.8.0
- app-play-scraper version: 0.17.0
Description:
app-store-scraper still uses the dependency "request 2.88.2" which is already a deprecated on Feb 11th 2020. Is there any possibility to replace request with axios or node-fetch or whichever compatible to the latest version. module works perfect without flaws but still the use of deprecated dependency "request" again has sub dependencies [email protected] & [email protected] which are deprecated too
or may be can it be converted with the new request.js (Changed HTTP Library) as in utils folder of google-play-scrapper
We switched to axios before and it broke some features, don't have the link handy right now I think it was proxy. So we had to switch back
that would be so bad, let me see if i can work out some round around solution
is it the JSON String Response of the "body" which varies when changing from request to axios which is causing the problems. Let me try to get the lookup string from axios & compare ??
@facundoolano - Check this out, i have temporarily changed the app.js and common.js with the use of axios. I am sending out just first JSON of the search at the moment. Can be worked out for array of elements as it was. This is just a starter
APP.JS
'use strict';
const common = require('./common'); const ratings = require('./ratings');
async function app (opts) { if (!opts.id && !opts.appId) { throw Error('Either id or appId is required'); } const idField = opts.id ? 'id' : 'bundleId'; const idValue = opts.id || opts.appId;
const output = await common.lookup([idValue], idField, opts.country, opts.lang, opts.requestOptions) .then((result) => { if (!result) { throw Error('App not found (404)'); } if (opts.ratings) { if (!opts.id) { opts.id = result.id; } return ratings(opts).then((ratingsResult) => Object.assign({}, result, ratingsResult)); } return result; }); return output; }
module.exports = app;
COMMON.JS
'use strict';
const axios = require('axios'); const debug = require('debug')('app-store-scraper'); const c = require('./constants');
function cleanApp (app) { return { id: app.trackId, appId: app.bundleId, title: app.trackName, url: app.trackViewUrl, description: app.description, icon: app.artworkUrl512 || app.artworkUrl100 || app.artworkUrl60, genres: app.genres, genreIds: app.genreIds, primaryGenre: app.primaryGenreName, primaryGenreId: app.primaryGenreId, contentRating: app.contentAdvisoryRating, languages: app.languageCodesISO2A, size: app.fileSizeBytes, requiredOsVersion: app.minimumOsVersion, released: app.releaseDate, updated: app.currentVersionReleaseDate || app.releaseDate, releaseNotes: app.releaseNotes, version: app.version, price: app.price, currency: app.currency, free: app.price === 0, developerId: app.artistId, developer: app.artistName, developerUrl: app.artistViewUrl, developerWebsite: app.sellerUrl, score: app.averageUserRating, reviews: app.userRatingCount, currentVersionScore: app.averageUserRatingForCurrentVersion, currentVersionReviews: app.userRatingCountForCurrentVersion, screenshots: app.screenshotUrls, ipadScreenshots: app.ipadScreenshotUrls, appletvScreenshots: app.appletvScreenshotUrls, supportedDevices: app.supportedDevices }; }
const LOOKUP_URL = 'https://itunes.apple.com/lookup';
async function lookup (ids, idField, country, lang, requestOptions) {
idField = idField || 'id';
country = country || 'us';
const langParam = lang ? &lang=${lang} : '';
const joinedIds = ids.join(',');
const url = ${LOOKUP_URL}?${idField}=${joinedIds}&country=${country}&entity=software${langParam};
const appData = axios.get(url).then(res => { //Temporarily Sending First Data OUT (Directly as a JSON) const app = res.data.results[0]; if ((app.wrapperType === 'undefined') || (app.wrapperType === 'software')) { return app; } }).then(res => { const app = cleanApp(res); return app; }); return appData; }
function storeId (countryCode) { const markets = c.markets; const defaultStore = '143441'; return (countryCode && markets[countryCode.toUpperCase()]) || defaultStore; }
module.exports = { cleanApp, lookup, storeId };
@facundoolano Would it be possible to migrate from request to got? (same as google-store-scraper)
it is actually possible to update from request to axios since app-store scrapping just gives back the json value and i think i have re-coded it at my end removing the request
On Fri, 5 Jan 2024 at 15:46, Alex S. @.***> wrote:
@facundoolano https://github.com/facundoolano Would it be possible to migrate from request to got? (same as google-store-scraper)
— Reply to this email directly, view it on GitHub https://github.com/facundoolano/app-store-scraper/issues/176#issuecomment-1878875209, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYNHESTYWGO2MHHGASZFI3DYNAN5FAVCNFSM5RV25MO2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBXHA4DONJSGA4Q . You are receiving this because you authored the thread.Message ID: @.***>