Giter Site home page Giter Site logo

Character info search about malscraper HOT 9 OPEN

kylart avatar kylart commented on June 15, 2024
Character info search

from malscraper.

Comments (9)

LegendaryEmoji avatar LegendaryEmoji commented on June 15, 2024 2

This feature is completely possible if you are wondering.

scraper.getInfoFromName(query...) function actually does two things when called:

  1. Send a GET request to https://myanimelist.net/search/prefix.json?type=anime&keyword={query} to get all the results of type anime.
  2. Find the best anime result (or the first anime result depending on getBestMatch parameter) and send another GET request to the selected anime result's URL and parse the raw HTML and return the anime data.

You could modify the function to add support for type parameter. So, instead of hardcoded type=anime, you could do the following and the code would change the type parameter (code location):

// New usage:
scraper.getInfoFromName(query, getBestMatch=true, type="anime");

scraper.getInfoFromName("Spy x Family");
// -> Using https://myanimelist.net/search/prefix.json?type=anime&keyword=Spy+x+Family
// -> If no type is provided, it would use `anime` as type by default.

scraper.getInfoFromName("Spy x Family", true, "anime");
// -> Using https://myanimelist.net/search/prefix.json?type=anime&keyword=Spy+x+Family
// -> If type is provided, it would use the provided type.

scraper.getInfoFromName("Forger", true, "character");
// -> Using https://myanimelist.net/search/prefix.json?type=character&keyword=Forger
// -> If type is provided, it would use the provided type.

Honestly, this whole type thing is a bit flawed, but without it, searching would become really difficult as most of the people only need anime results.

I would've made a PR (Pull Request) but seeing how the main developer is inactive, I doubt that it would get merged anytime soon.

from malscraper.

LegendaryEmoji avatar LegendaryEmoji commented on June 15, 2024 2

This would take a little longer. I am planning to add more things other than this single thing. I'll keep you updated.

from malscraper.

LegendaryEmoji avatar LegendaryEmoji commented on June 15, 2024 2

I am expecting this to take around solid 2-3 weeks of work. After this update, this package will be able to scrape everything literally. For example, you would be able to scrape all forum posts of user, users comments posted on the user page, clubs, badges, detailed biography and comments, reviews, recommendations, and so on. My initial plan was to just add this type and be done, but after digging, it seems like this package really needs some updates.

Don't worry, I'll let both of you know when it's done. Sorry for the constant delays, it's just that there are too many things.

from malscraper.

StavrosNik4 avatar StavrosNik4 commented on June 15, 2024

I don't think there is such feature. Also I'm not really sure how we are going to implement this because links of character pages have a specific ID before the name of the character as you can see in the screenshots below.
image
image
image

from malscraper.

StavrosNik4 avatar StavrosNik4 commented on June 15, 2024

@LegendaryEmoji If you have the code ready then please make a PR. Kylart is not inactive on GitHub, he will see it anytime soon. I will also work on an implementation and we can discuss them in the PR.

from malscraper.

LegendaryEmoji avatar LegendaryEmoji commented on June 15, 2024

I don't have the code ready yet. The reason is simple, if we decided to add character searching, we would also need to add parsing for the raw character HTML page and so on. This isn't a simple function change if you want detailed information. I would need some time (e.g. 3-5 days) to code this feature. I will definitely need help regarding TypeScript typing so you can help me in that in the pull request (@StavrosNik4).

from malscraper.

Kylart avatar Kylart commented on June 15, 2024

You have two solutions if you're willing to make a PR and are unsure it will get merge because of an inactive maintainer:

  1. fork the project and use your fork repo as your dependency in your project
  2. In this case, if I don't see your PR in a timely manner, feel free to send me an email and I will probably react quickly.

In the meantime, I greatly appreciate your contributions even though I don't have that much time to take care of these projects!

from malscraper.

LegendaryEmoji avatar LegendaryEmoji commented on June 15, 2024

@Kylart would it be fine if I make major changes like changes which will break the package for sure? Of course, this update of mine will be "3.0.0" instead of adding more to "2.x.x" version as this update would introduce many new functions, models, and things.

from malscraper.

Kylart avatar Kylart commented on June 15, 2024

Sounds great to me!

This package is in dire needs of update. I planned on working on this whenever I got the chance so I'm looking forward to this. Please do not feel pressured by time or anything, it's already great 👍

from malscraper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.