moonlitgrace / mangareader-api

A Python based web scraping api built with fastapi that provides easy access to manga contents

Home Page:https://mangareader-api.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

refactor: move `__get_parser` to `helpers`

moonlitgrace opened this issue · comments

Hi, again) Do u need to new class, for example, HTMLHelper in new file helpers/html.py or move to helpers/string.py?

And I can use moved __get_parser() for most_viewed.py, topten.py, popular.py because it use __get_parser().
I think change to:

class HTMLHelper:
   @staticmethod
   def __get_parser(url: str) -> HTMLParser: 
       res = requests.get(url) 
       return HTMLParser(res.content) 

Hi @issamansur :)

HTMLHelper in new file helpers/html.py

Yes, create a new file html.py sounds good -> HTMLHelper class ( remove __ naming convection )
Yup sounds good

class HTMLHelper:
   @staticmethod
   def get_parser(url: str) -> HTMLParser: 
       res = requests.get(url) 
       return HTMLParser(res.content) 

I created file html_helper.py instead of html.py because in helpers/string.py u use import html for another lib