md-y/mangadex-full-api

No pages being returned with the Chapter

Closed this issue · 1 comments

To reproduce:

const api = require("mangadex-full-api");

api.agent.login("user", "password", false).then(async () => {
    var chapter = await api.Chapter.get(208447);

    console.log(chapter.pages);
});

This prints an empty list rather than a list of urls.

It looks like this is because the api has changed from giving data.page_array to data.pages as seen here:
https://api.mangadex.org/v2/chapter/208447 =>

{
  "code": 200,
  "status": "OK",
  "data": {
    "id": 208447,
    "hash": "c549709c5c1054ecd4a14aadfd7f6cc4",
    "mangaId": 1873,
    "mangaTitle": "Haikyuu!!",
    "volume": "7",
    "chapter": "62",
    "title": "The Full Width of the Court",
    "language": "gb",
    "groups": [
      {
        "id": 744,
        "name": "Casanova"
      }
    ],
    "uploader": 5004,
    "timestamp": 1522072694,
    "threadId": 0,
    "comments": 0,
    "views": 6757,
    "status": "OK",
    "pages": [
      "x1.png",
      "x2.png",
      "x3.png",
      "x4.png",
      "x5.png",
      "x6.png",
      "x7.png",
      "x8.png",
      "x9.png",
      "x10.png",
      "x11.png",
      "x12.png",
      "x13.png",
      "x14.png",
      "x15.jpg",
      "x16.jpg"
    ],
    "server": "https://enq5td3bvd9v4.t7tasf268ceb0.mangadex.network:443/jON5jN9J2ELAnGlYuDlm9Hmzcop1lbDB_5G9Ivtp2w53VhOO79082WKmf6YR0lcjyKgUSdzD_a5TpalFdZDZUZNeoLAhKrT_WgFphHbpQbbxWdR5Xz-Tm_OhQZiUucLMOPL03j53gcZeE2uE29NzZPSe6S3X1i9qnXLhoGepvzgoZEqKTHhRAaR3_1icYdS87l3UZdXoKvA_veZnDLk69nxyh0Dl/data/",
    "serverFallback": "https://s2.mangadex.org/data/"
  }
}

Seeing as this looks simple I'll try and submit a PR to fix it :)

md-y commented

I think I forgot to switch to pages when I was migrating to V2, or it changed like you said and I didn't notice. Either way, thank you for #24!