app-store-scraper icon indicating copy to clipboard operation
app-store-scraper copied to clipboard

Unexpected token, cannot get reviews

Open LrDaniel opened this issue 1 year ago • 3 comments

  • Operating System: macOS
  • Node version: 18.20
  • app-play-scraper version: 0.18.0

Getting an "Unexpected token < in JSON at position 0" when trying to get reviews

checking the response from the itunes url
const url = https://itunes.apple.com/${opts.country}/rss/customerreviews/page=${opts.page}/id=${id}/sortby=${opts.sort}/json; im getting this HTML :

<body onload="return its.detect.openItunes('https://itunes.apple.com/us/store?ign-mscache=1');">

 <!-- InternetExplorer ActiveX Component (must have non-zero width/height!) -->
 <object classID="CLSID:D719897A-B07A-4C0C-AEA9-9B663A28DFCB" width="1" height="1" id="iTunesDetectorIE" ></object>
  <div id="loadingbox-wrapper">
  <div class="loadingbox">
     <p class="title">Connecting to the iTunes Store.<span id="loading-dots">..</span></p>

      <div class="clear"></div>

        <!-- User Override Panel.
           By default, we show this panel so users with javascript disabled can click through
           to the store.  If javascript is enabled, the code snippet at the bottom of the div
           will hide the panel. AFTER that, if the check for iTunes yields indeterminate results,
           this panel will be unhidden by the script in itmsCheck.js.
           Don't change the id of this div; it's used by itmsCheck.js
         -->
        <div id="itunes-client-required" style="display:block;">
         <center><br>
          <p style="color: red;">
           We are unable to find iTunes on your computer.
          </p><br>
           <a onclick="its.detect.userOverrideSetItunesInstalled(); its.detect.openItunes(); return true;" href="#">
            <input type="submit" value="I have iTunes" />
           </a>
          <a href="http://www.apple.com/itunes/download/?itunesInstalled=unknown"><input type="submit" value="Download iTunes" /></a>
         </center>
         <script type="text/javascript">
           document.getElementById('itunes-client-required').style.display='none';
         </script>
        </div>
        <!-- End user override panel -->

     <p class="footer">If you don't have iTunes, <a href="http://www.apple.com/itunes/download/">download it for free</a>. If you have iTunes and it doesn't open automatically, try opening it from your dock or Windows task bar.</p>
  </div></div>
 </body>

LrDaniel avatar Oct 31 '24 13:10 LrDaniel

  • Operating System: macOS 15
  • Node version: 18.20
  • app-play-scraper version: 0.18.0

Getting an "Unexpected token < in JSON at position 0" when trying to get reviews

checking the response from the itunes url const url = https://itunes.apple.com/${opts.country}/rss/customerreviews/page=${opts.page}/id=${id}/sortby=${opts.sort}/json; im getting this HTML :

<body onload="return its.detect.openItunes('https://itunes.apple.com/us/store?ign-mscache=1');">

 <!-- InternetExplorer ActiveX Component (must have non-zero width/height!) -->
 <object classID="CLSID:D719897A-B07A-4C0C-AEA9-9B663A28DFCB" width="1" height="1" id="iTunesDetectorIE" ></object>
  <div id="loadingbox-wrapper">
  <div class="loadingbox">
     <p class="title">Connecting to the iTunes Store.<span id="loading-dots">..</span></p>

      <div class="clear"></div>

        <!-- User Override Panel.
           By default, we show this panel so users with javascript disabled can click through
           to the store.  If javascript is enabled, the code snippet at the bottom of the div
           will hide the panel. AFTER that, if the check for iTunes yields indeterminate results,
           this panel will be unhidden by the script in itmsCheck.js.
           Don't change the id of this div; it's used by itmsCheck.js
         -->
        <div id="itunes-client-required" style="display:block;">
         <center><br>
          <p style="color: red;">
           We are unable to find iTunes on your computer.
          </p><br>
           <a onclick="its.detect.userOverrideSetItunesInstalled(); its.detect.openItunes(); return true;" href="#">
            <input type="submit" value="I have iTunes" />
           </a>
          <a href="http://www.apple.com/itunes/download/?itunesInstalled=unknown"><input type="submit" value="Download iTunes" /></a>
         </center>
         <script type="text/javascript">
           document.getElementById('itunes-client-required').style.display='none';
         </script>
        </div>
        <!-- End user override panel -->

     <p class="footer">If you don't have iTunes, <a href="http://www.apple.com/itunes/download/">download it for free</a>. If you have iTunes and it doesn't open automatically, try opening it from your dock or Windows task bar.</p>
  </div></div>
 </body>

LrDaniel avatar Oct 31 '24 13:10 LrDaniel

I have the same problem.

brunnoandradegok avatar Oct 31 '24 18:10 brunnoandradegok

https://www.npmjs.com/package/app-store-client

I have created a TypeScript version. This one works well. Please check it out.

ngo275 avatar Dec 02 '24 10:12 ngo275