unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: Stefan Huchler <stefan.huchler@mail.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: elisps dom library doesn't work as I expect
Date: Tue, 09 May 2023 05:32:21 +0000	[thread overview]
Message-ID: <87fs866pei.fsf@vagabond.tim-landscheidt.de> (raw)
In-Reply-To: <87ttwmgnxg.fsf@mail.de> (Stefan Huchler's message of "Tue, 09 May 2023 05:54:03 +0200")

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	other threads:[~2023-05-09  5:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09  3:54 elisps dom library doesn't work as I expect Stefan Huchler
2023-05-09  5:32 ` Tim Landscheidt [this message]
2023-05-10  3:56   ` Stefan Huchler
2023-05-10 20:18     ` Tim Landscheidt
2023-05-20 19:40       ` Stefan Huchler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fs866pei.fsf@vagabond.tim-landscheidt.de \
    --to=tim@tim-landscheidt.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=stefan.huchler@mail.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).