help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: elisps dom library doesn't work as I expect


From: Tim Landscheidt
Subject: Re: elisps dom library doesn't work as I expect
Date: Tue, 09 May 2023 05:32:21 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Stefan Huchler <stefan.huchler@mail.de> wrote:

> I try to webscrape ebay auctions, but I can't scape the name as example:

> […]
>   (print (length (dom-elements
>                 (dom-by-tag ebay-tracker-auction 'meta)
>                 'itemprop "name"))))

> ;; data that I try to scrape:
> ;; <meta itemprop="name" content="Sony Bravia XR-55A90J  OLED TV - TOP">
> (ebay-tracker--query-test "185887279856")

> Also the dom-elements funktion is not described on the gnu website, yet
> it's the only way to find elements with this library that don't use
> class or id as attributes. shouldn't that code find this node?

dom-by-tag returns a list of DOM elements; however,
dom-elements expects a single DOM element as its second ar-
gument.  So you need to iterate over the list of DOM ele-
ments returned by dom-by-tag and call dom-elements on each,
or use dom-search, etc.

Tim



reply via email to

[Prev in Thread] Current Thread [Next in Thread]