def next(self, fetch: bool = False, next_symbol: _NextSymbol = DEFAULT_NEXT_SYMBOL) -> _Next:
        """Attempts to find the next page, if there is one. If ``fetch``
        is ``True`` (default), returns :class:`HTML <HTML>` object of
        next page. If ``fetch`` is ``False``, simply returns the next URL.

        """

        def get_next():
            candidates = self.find('a', containing=next_symbol)

            for candidate in candidates:
                if candidate.attrs.get('href'):
                    # Support 'next' rel (e.g. reddit).
                    if 'next' in candidate.attrs.get('rel', []):
                        return candidate.attrs['href']

                    # Support 'next' in classnames.
                    for _class in candidate.attrs.get('class', []):
                        if 'next' in _class:
                            return candidate.attrs['href']

                    if 'page' in candidate.attrs['href']:
                        return candidate.attrs['href']

            try:
                # Resort to the last candidate.
                return candidates[-1].attrs['href']
            except IndexError:
                return None

        __next = get_next()
        if __next:
            url = self._make_absolute(__next)
        else:
            return None

        if fetch:
            return self.session.get(url)
        else:
            return url
def next ( self , fetch : bool = False , next_symbol : _NextSymbol = DEFAULT_NEXT_SYMBOL ) -> _Next : def get_next ( ) : candidates = self . find ( 'a' , containing = next_symbol ) for candidate in candidates : if candidate . attrs . get ( 'href' ) : if 'next' in candidate . attrs . get ( 'rel' , [ ] ) : return candidate . attrs [ 'href' ] for _class in candidate . attrs . get ( 'class' , [ ] ) : if 'next' in _class : return candidate . attrs [ 'href' ] if 'page' in candidate . attrs [ 'href' ] : return candidate . attrs [ 'href' ] try : return candidates [ - 1 ] . attrs [ 'href' ] except IndexError : return None __next = get_next ( ) if __next : url = self . _make_absolute ( __next ) else : return None if fetch : return self . session . get ( url ) else : return url
Attempts to find the next page, if there is one. If ``fetch``
        is ``True`` (default), returns :class:`HTML <HTML>` object of
        next page. If ``fetch`` is ``False``, simply returns the next URL.