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

make getMultiple include pornographic mangas #61

Merged
merged 1 commit into from
Mar 7, 2022
Merged

make getMultiple include pornographic mangas #61

merged 1 commit into from
Mar 7, 2022

Conversation

Nowaaru
Copy link
Contributor

@Nowaaru Nowaaru commented Feb 24, 2022

oh my GOD IT HAPPENED AGAIN NOO-
i am going insane

Manga.getMultiple() does not work with pornographic rated manga; however, it works for erotica, suggestive, and safe.

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

MFA.Manga.getMultiple([
  "239a69f9-a43f-4401-82f1-eb5527877f7d", // Pornographic
  "23d61ae3-db1a-4136-9f48-23b65a49931f", // Erotica
  "7aa736f1-e56c-4186-b42c-ed68c81f7244", // Suggestive
  "b22829b3-a255-4de5-be56-42c9d5d81eb3", // Safe
]).then(async (res) => {
  console.log(await res);
});
Results
[
  Manga {
    id: '23d61ae3-db1a-4136-9f48-23b65a49931f',
    localizedTitle: LocalizedString {
      en: "Max Mojave's Case",
      availableLocales: [Array]
    },
    localizedAltTitles: [ [LocalizedString] ],
    localizedDescription: LocalizedString {
      en: '"The moment I first saw him, I thought I was really going to die." A boy who had to kill a man and a boy who watched the scene by mistake. Max is a criminal and Chris is the one who is chasing his trail. The moment that changed their lives have reunited them now as roommates, but… What is this feeling emerging from the growing tension?',
      availableLocales: [Array]
    },
    isLocked: false,
    links: Links {
      al: 'https://anilist.co/manga/anilist.co/manga/128756',
      ap: undefined,
      bw: undefined,
      mu: 'https://www.mangaupdates.com/series.html?id=178345',
      nu: undefined,
      mal: undefined,
      kt: undefined,
      kit: 'https://kitsu.io/api/edge/manga?filter[slug]=kitsu.io/manga/61601',
      amz: undefined,
      ebj: undefined,
      raw: 'https://www.lezhin.com/ko/comic/max_mohavi_case/',
      engtl: undefined,
      cdj: undefined,
      availableLinks: [Array]
    },
    originalLanguage: 'ko',
    lastVolume: '',
    lastChapter: '',
    publicationDemographic: null,
    status: 'ongoing',
    year: null,
    contentRating: 'erotica',
    createdAt: 2021-02-17T16:03:07.000Z,
    updatedAt: 2021-11-12T08:52:29.000Z,
    authors: [ [Relationship] ],
    artists: [ [Relationship] ],
    mainCover: Relationship {
      id: '519003a8-c334-4fa5-80bb-61fe5c432eeb',
      type: 'cover_art',
      cached: false
    },
    tags: [
      [Tag], [Tag],
      [Tag], [Tag],
      [Tag], [Tag],
      [Tag]
    ],
    relatedManga: {
      monochrome: [],
      main_story: [],
      adapted_from: [],
      based_on: [],
      prequel: [],
      side_story: [],
      doujinshi: [],
      same_franchise: [],
      shared_universe: [],
      sequel: [],
      spin_off: [],
      alternate_story: [],
      preserialization: [],
      colored: [],
      serialization: []
    },
    version: 3,
    chapterNumbersResetOnNewVolume: false,
    availableTranslatedLanguages: [ 'en' ],
    state: 'published'
  },
  Manga {
    id: '7aa736f1-e56c-4186-b42c-ed68c81f7244',
    localizedTitle: LocalizedString {
      en: 'He~nshin!! - Sonata Birdie Rush',
      availableLocales: [Array]
    },
    localizedAltTitles: [
      [LocalizedString],
      [LocalizedString],
      [LocalizedString],
      [LocalizedString],
      [LocalizedString]
    ],
    localizedDescription: LocalizedString {
      en: "Hayama Sonata has been a pro golfer for 2 years, but she has never played in a pro golf match. It's because she doesn't have a sponsor to pay for the cost of a match. One day a weird president of a company comes to make a contract of sponsorship with her. The requirement for the contract is that Hayama must do cosplay in her matches. Can she become a real pro golfer and beat all her opponents?",
      availableLocales: [Array]
    },
    isLocked: false,
    links: Links {
      al: 'https://anilist.co/manga/48263',
      ap: 'https://www.anime-planet.com/manga/he-nshin-sonata-birdie-rush',
      bw: undefined,
      mu: 'https://www.mangaupdates.com/series.html?id=33921',
      nu: undefined,
      mal: 'https://myanimelist.net/manga/18263',
      kt: 'https://kitsu.io/api/edge/manga/6026',
      amz: 'https://www.amazon.co.jp/gp/product/B075T3X769',
      ebj: undefined,
      raw: undefined,
      engtl: undefined,
      cdj: undefined,
      availableLinks: [Array]
    },
    originalLanguage: 'ja',
    lastVolume: '5',
    lastChapter: '28',
    publicationDemographic: 'seinen',
    status: 'completed',
    year: null,
    contentRating: 'suggestive',
    createdAt: 2018-03-13T14:14:11.000Z,
    updatedAt: 2021-05-25T15:44:10.000Z,
    authors: [ [Relationship] ],
    artists: [ [Relationship] ],
    mainCover: Relationship {
      id: '96f63445-fc18-4fad-bbb3-895721807a09',
      type: 'cover_art',
      cached: false
    },
    tags: [ [Tag], [Tag], [Tag] ],
    relatedManga: {
      monochrome: [],
      main_story: [],
      adapted_from: [],
      based_on: [],
      prequel: [],
      side_story: [],
      doujinshi: [],
      same_franchise: [],
      shared_universe: [],
      sequel: [],
      spin_off: [],
      alternate_story: [],
      preserialization: [],
      colored: [],
      serialization: []
    },
    version: 2,
    chapterNumbersResetOnNewVolume: false,
    availableTranslatedLanguages: [ 'en' ],
    state: 'published'
  },
  Manga {
    id: 'b22829b3-a255-4de5-be56-42c9d5d81eb3',
    localizedTitle: LocalizedString {
      en: 'Weekend Cinderella',
      availableLocales: [Array]
    },
    localizedAltTitles: [ [LocalizedString], [LocalizedString] ],
    localizedDescription: LocalizedString {
      en: "At school Kaname is flawless, handsome, and popular, however, his hobby is cross-dressing. With the assistance of his sister who is a beautician and his mother who is a design",
      based_on: [],      
      prequel: [],
      side_story: [],
      doujinshi: [],
      same_franchise: [],
      shared_universe: [],
      sequel: [],
      spin_off: [],
      alternate_story: [],
      preserialization: [],
      colored: [],
      serialization: []
    },
    version: 1,
    chapterNumbersResetOnNewVolume: false,
    availableTranslatedLanguages: [],
    state: 'published'
  }
]

this is speculative, but it appears that the reason this happens is because the util function fills in its own searchParameters, which does not take in consideration contentRating, thus leading mangadex to fill in contentRating to ['safe', 'suggestive', 'erotica'] by default.

i determined that the fix with the least amount of casualties would just be to add a parameterObject parameter to getMultipleIds(...). i thought this would be best instead of creating a new function since the latter would make clutter
since only one function would use it - that being the manga function. with this fix, only one other function would be changed,
and that would be in cover.js where i had to fill in an empty object to compensate for the new parameter.

also made a new test for the heehoos

this was my first PR ever so apologies if i did something wrong !!

@md-y
Copy link
Owner

md-y commented Mar 7, 2022

Hopefully this will be the end of your troubles haha

@md-y md-y merged commit 6f4f244 into md-y:master Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants