Comments (9)
This feature is completely possible if you are wondering.
scraper.getInfoFromName(query...)
function actually does two things when called:
- Send a GET request to
https://myanimelist.net/search/prefix.json?type=anime&keyword={query}
to get all the results of typeanime
. - 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.
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.
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.
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.
from malscraper.
@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.
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.
You have two solutions if you're willing to make a PR and are unsure it will get merge because of an inactive maintainer:
- fork the project and use your fork repo as your dependency in your project
- 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.
@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.
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)
- Replace Request HOT 4
- Error: A 'declare' modifier cannot be used in an already ambient context.
- Images broken HOT 14
- breaking changes to xml2js HOT 2
- 2.12.1 release date ? HOT 4
- SearchResultsDataModel incorrect types
- Not getting all episodes HOT 2
- high vulnerability HOT 2
- Install Error HOT 2
- Fetching user info in getWatchListFromUser HOT 2
- Manga Details HOT 1
- Fix typo HOT 2
- Support HOT 7
- getRecommendationsList parameter object does not need name HOT 1
- shortDescription
- .getInfoFromName() shows a max 10 characters HOT 1
- Update on .getInfoFromName() HOT 1
- Sorted search results HOT 3
- Next Release ? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from malscraper.