Shosetsu/VNDB.py
async def search_vndb(self, stype, term):
        """
        Search vndb.org for a term and return matching results from type.

        :param stype: type to search for.
            Type should be one of:
                v - Visual Novels
                r - Releases
                p - Producers
                s - Staff
                c - Characters
                g - Tags
                i - traits
                u - Users
        :param term: string to search for
        :return: Results. Result format depends on what you searched for. See the Parsing.py module for more specific documentation.

        Exceptions:
            aiohttp.HttpBadRequest - On 404s
            VNDBOneResult - When you search for something but it instead redirects us to a direct content page
            VNDBNoResults - When nothing was found for that search
            VNDBBadStype - Raised when an incorrect search type is passed
        """
        fstype = ""
        if stype not in ['v', 'r', 'p', 's', 'c', 'g', 'i', 'u']:
            raise VNDBBadStype(stype)
        else:
            if stype in ['v', 'p', 's', 'c', 'u']:
                fstype = '/{}/all'.format(stype)
            elif stype in ['g', 'i']:
                fstype = '/{}/list'.format(stype)
            elif stype == 'r':
                fstype = '/r'
        async with self.session.get(self.base_url + "{}".format(fstype), params={"q": term}, headers=self.headers) as response:
            if response.status == 404:
                raise aiohttp.HttpBadRequest("VN Not Found")
            elif 'q=' not in response.url:
                raise VNDBOneResult(term, response.url.rsplit('/', 1)[1])
            text = await response.text()
            if 'No Results' in text:
                raise VNDBNoResults(term)
            soup = BeautifulSoup(text, 'lxml')
            resp = await self.parse_search(stype, soup)
            if resp == []:
                raise VNDBNoResults(term)
            return resp
async def search_vndb(self, stype, term):
        fstype = ""
        if stype not in ['v', 'r', 'p', 's', 'c', 'g', 'i', 'u']:
            raise VNDBBadStype(stype)
        else:
            if stype in ['v', 'p', 's', 'c', 'u']:
                fstype = '/{}/all'.format(stype)
            elif stype in ['g', 'i']:
                fstype = '/{}/list'.format(stype)
            elif stype == 'r':
                fstype = '/r'
        async with self.session.get(self.base_url + "{}".format(fstype), params={"q": term}, headers=self.headers) as response:
            if response.status == 404:
                raise aiohttp.HttpBadRequest("VN Not Found")
            elif 'q=' not in response.url:
                raise VNDBOneResult(term, response.url.rsplit('/', 1)[1])
            text = await response.text()
            if 'No Results' in text:
                raise VNDBNoResults(term)
            soup = BeautifulSoup(text, 'lxml')
            resp = await self.parse_search(stype, soup)
            if resp == []:
                raise VNDBNoResults(term)
            return resp
async def search_vndb ( self , stype , term ) : fstype = "" if stype not in [ 'v' , 'r' , 'p' , 's' , 'c' , 'g' , 'i' , 'u' ] : raise VNDBBadStype ( stype ) else : if stype in [ 'v' , 'p' , 's' , 'c' , 'u' ] : fstype = '/{}/all' . format ( stype ) elif stype in [ 'g' , 'i' ] : fstype = '/{}/list' . format ( stype ) elif stype == 'r' : fstype = '/r' async with self . session . get ( self . base_url + "{}" . format ( fstype ) , params = { "q" : term } , headers = self . headers ) as response : if response . status == 404 : raise aiohttp . HttpBadRequest ( "VN Not Found" ) elif 'q=' not in response . url : raise VNDBOneResult ( term , response . url . rsplit ( '/' , 1 ) [ 1 ] ) text = await response . text ( ) if 'No Results' in text : raise VNDBNoResults ( term ) soup = BeautifulSoup ( text , 'lxml' ) resp = await self . parse_search ( stype , soup ) if resp == [ ] : raise VNDBNoResults ( term ) return resp
Search vndb.org for a term and return matching results from type.

        :param stype: type to search for.
            Type should be one of:
                v - Visual Novels
                r - Releases
                p - Producers
                s - Staff
                c - Characters
                g - Tags
                i - traits
                u - Users
        :param term: string to search for
        :return: Results. Result format depends on what you searched for. See the Parsing.py module for more specific documentation.

        Exceptions:
            aiohttp.HttpBadRequest - On 404s
            VNDBOneResult - When you search for something but it instead redirects us to a direct content page
            VNDBNoResults - When nothing was found for that search
            VNDBBadStype - Raised when an incorrect search type is passed
Search vndb . org for a term and return matching results from type .