As first thing, please copy the code below and paste it inside a your_website_name.py file under resources folder.
import falcon
import aiohttp
from utils.session import execute_proxied_request
from falcon import uri
from typing import List
from bs4 import BeautifulSoup
from interfaces.resource import ScraperResource
from models.episode import Episode
from models.matching import Matching
class YourWebsiteNameHere(ScraperResource):
def __init__(self, app: falcon.App) -> None:
# On this line, use the name you used inside MongoDB's websites collection
super().__init__(app, "yourwebsitenamehere")
async def get_possible_matchings(self, res: falcon.Response, title: str) -> List[Matching]:
matchings = []
try:
# Your website logic here
except Exception as e:
print(str(e))
raise
return matchings
async def get_episode(self, res: falcon.Response, path: str, number: int) -> List[Episode]:
episodes = []
try:
# Your website logic here
except Exception as e:
print(str(e))
raise
return episodesAfter, edit main.py file and add (at the end of the file) this line of code:
YourWebsiteNameHere(app)Alright! Now you can write your custom logic to add your favourite website to AniAPI.
If you need more help going throught this, you can refer to this example.