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

Top charts: selectedChart can be null #9

Open
baltpeter opened this issue Jul 24, 2023 · 0 comments
Open

Top charts: selectedChart can be null #9

baltpeter opened this issue Jul 24, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@baltpeter
Copy link
Member

I got this error:

/home/benni/coding/JS/tweasel/experiments/monkey-july-2023/node_modules/parse-tunes/dist/src/top-charts.ts:72
}
^


TypeError: Cannot read properties of null (reading 'adamIds')
    at $9b29393ae56a7950$export$91a6a7f4f6f8ec4f (/home/benni/coding/JS/tweasel/experiments/monkey-july-2023/node_modules/parse-tunes/dist/src/top-charts.ts:72:1)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 25)
    at <anonymous> (/home/benni/coding/JS/tweasel/experiments/monkey-july-2023/app-list.ts:29:9)

Node.js v18.16.1

when running this code:

import { fetchTopApps, charts, countries, genres } from 'parse-tunes';

(async () => {
    const iosEntries = (
        await Promise.all(
            Object.values(genres).map((genre) =>
                fetchTopApps({
                    genre,
                    chart: charts.topFreeIphone,
                    country: countries.DE,
                })
            )
        )
    )
        .map((l) => l.slice(0, 30))
        .flat();
})();

The problem is that selectedChart can be null. Here's what res.pageData.segmentedControl.segments[0].pageData looks like for the failing chart:

{
  metricsBase: {
    pageType: 'TopChartsPage',
    pageId: '6025',
    pageDetails: 'Stickers',
    page: 'TopChartsPage_6025',
    serverInstance: '3311305',
    storeFrontHeader: '143443,29',
    language: '4',
    storeFront: '143443'
  },
  topCharts: [],
  selectedChart: null,
  pageTitle: 'Charts',
  genre: {
    name: 'Sticker',
    id: '6025',
    url: 'https://itunes.apple.com/de/genre?id=6025'
  },
  categoryList: {
    url: 'https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?cc=de&genreId=36&popId=27',
    chartUrl: 'https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?cc=de&genreId=36&popId=30',
    name: 'App Store',
    shortName: 'App Store',
    buttonName: 'Kategorien',
    genreId: '36',
    art: {
      token: 'Purple126/v4/a3/b9/c4/a3b9c469-999c-af3f-c609-cdda97635cc8/AppIcon-1x_U007emarketing-0-7-0-85-220.png',
      pft: 'LargeApplicationIcon'
    },
    artwork: [
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object]
    ],
    kind: 'iosSoftware',
    parentCategoryLabel: 'Alle Kategorien',
    children: [
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object]
    ]
  },
  componentName: 'top_charts_page',
  metrics: { config: {}, fields: {} }
}
@baltpeter baltpeter added the bug Something isn't working label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant