requests-html icon indicating copy to clipboard operation
requests-html copied to clipboard

Need method get all children

Open liking opened this issue 7 years ago • 6 comments

Hi Please add some method work with children nodes same as lxml.etree.getchildren()

Currently, I'm using requests-html but sometime I must using lxml.etree to load html from Element, after that, using etree to get children :(

Thanks so much. This is awesome project.

liking avatar Sep 28 '18 09:09 liking

Hi @liking

Thanks for your suggestion:)

Is anyone willing to implement this?

oldani avatar Feb 26 '19 15:02 oldani

i need this feature :smile:

tapionx avatar Jan 02 '20 14:01 tapionx

Hi, @oldani I am willing to implement this. It would be great if you could help me out a little with the functionality

Manasvi1997 avatar Aug 09 '20 18:08 Manasvi1997

Hi Please add some method work with children nodes same as lxml.etree.getchildren()

Currently, I'm using requests-html but sometime I must using lxml.etree to load html from Element, after that, using etree to get children :(

Thanks so much. This is awesome project.

hey I would like to fix this issue. Can you tell me how should I start?

harshkumar02 avatar Jan 10 '21 17:01 harshkumar02

Something like this?

def children(self: BaseParser):
    return [
        Element(element=child, url=self.url, default_encoding=self.default_encoding)
        for child in self.element.getchildren()
    ]

ettoc00 avatar Oct 24 '22 23:10 ettoc00