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

Add MAL Articles #563

Open
wants to merge 4 commits into
base: 5.0.0
Choose a base branch
from
Open

Add MAL Articles #563

wants to merge 4 commits into from

Conversation

irfan-dahir
Copy link
Collaborator

@irfan-dahir irfan-dahir commented Sep 21, 2024

This implements 6 new API endpoints and refactors how the news parser works.
Feature Tracker: #491

To do

  • getPinnedArticles
  • getRecentArticles
  • getArticlesByTag
  • getArticleTags
  • getArticleSearch
  • getArticle
  • Unit Tests

getPinnedArticles

Description: Retrieves the pinned featured article listing
URL: https://myanimelist.net/featured

API Request:

(new \Jikan\MyAnimeList\MalClient())
    ->getPinnedArticles(
        new \Jikan\Request\Article\PinnedArticlesRequest()
    );

REST API Remarks: Cache this. It's just 4 entries.

getRecentArticles

Description: Retrieves the latest featured article listing
URL: https://myanimelist.net/featured?p=1

API Request:

(new \Jikan\MyAnimeList\MalClient())
    ->getRecentArticles(
        new \Jikan\Request\Article\RecentArticleRequest(1)
    );

REST API Remarks: It would probably be best to use this method to loop through each ID, fetch their details via getArticles and index/populate them directly into MongoDB/TypeSense. This would allow us to provide a better search experience.

getArticlesByTag

Description: Retrieves article listing by tag
URL: https://myanimelist.net/featured/tag/interview

API Request:

(new \Jikan\MyAnimeList\MalClient())
    ->getArticlesByTag(
        new \Jikan\Request\Article\ArticlesByTagRequest('interview', 1)
    );

REST API Remarks: Won't need this scraper API call on the REST API because we'll have custom search.

getArticleSearch

Description: Retrieves article listing by query
URL: https://myanimelist.net/featured/search?q=test&p=1

API Request:

(new \Jikan\MyAnimeList\MalClient())
    ->getArticleSearch(
        new \Jikan\Request\Search\ArticleSearchRequest('test', 1)
    );

REST API Remarks: Won't need this scraper API call on the REST API because we'll have custom search.

getArticleTags

Description: Retrieves all article tags
URL: https://myanimelist.net/featured/tag

API Request:

(new \Jikan\MyAnimeList\MalClient())
    ->getArticleTags(
        new \Jikan\Request\Article\ArticleTagsRequest()
    );

REST API Remarks: Periodic sync and overwrite like we have for Anime and Manga Genres. There are many entries so we could paginate, provide basic name search (use case: auto completion).

getArticle

Description: Retrieves article resource
URL: https://myanimelist.net/featured/1

API Request:

(new \Jikan\MyAnimeList\MalClient())
    ->getArticle(
        new \Jikan\Request\Article\ArticleRequest(1)
    );

REST API Remarks: We'll use a periodic sync strategy with getRecentNews to get all new entries in one go and keep them updated as there may be a chance of articles being edited later on. Perhaps biweekly or once a month?

@irfan-dahir irfan-dahir added this to the 5.0.0 milestone Sep 21, 2024
@irfan-dahir irfan-dahir self-assigned this Sep 21, 2024
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.

1 participant