MCPcopy
hub / github.com/psf/requests-html / get_next

Method get_next

requests_html.py:440–461  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

438 """
439
440 def get_next():
441 candidates = self.find('a', containing=next_symbol)
442
443 for candidate in candidates:
444 if candidate.attrs.get('href'):
445 # Support 'next' rel (e.g. reddit).
446 if 'next' in candidate.attrs.get('rel', []):
447 return candidate.attrs['href']
448
449 # Support 'next' in classnames.
450 for _class in candidate.attrs.get('class', []):
451 if 'next' in _class:
452 return candidate.attrs['href']
453
454 if 'page' in candidate.attrs['href']:
455 return candidate.attrs['href']
456
457 try:
458 # Resort to the last candidate.
459 return candidates[-1].attrs['href']
460 except IndexError:
461 return None
462
463 __next = get_next()
464 if __next:

Callers

nothing calls this directly

Calls 1

findMethod · 0.80

Tested by

no test coverage detected