~ghost08/ratt

[PATCH 1/2] Add config for ebay-kleinanzeigen.de

Daniel Hecker <code@hummeline.de>
Details
Message ID
<20220106175954.2372-2-code@hummeline.de>
DKIM signature
missing
Download raw message
Patch: +62 -0
This configuration allows creating feeds for a german
portal for classified ads: ebay-kleinanzeigen.
---
 confs/ebay-kleinanzeigen.yml | 62 ++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 confs/ebay-kleinanzeigen.yml

diff --git a/confs/ebay-kleinanzeigen.yml b/confs/ebay-kleinanzeigen.yml
new file mode 100644
index 0000000..4617045
--- /dev/null
+++ b/confs/ebay-kleinanzeigen.yml
@@ -0,0 +1,62 @@
# This configuration allows creating feeds for a german
# portal for classified ads: ebay-kleinanzeigen.

regex: https://www.ebay\-kleinanzeigen.de/s\-.*
selectors:
  httpsettings:
    cookie: {}
    header: {}
    useragent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
      Chrome/90.0.4430.72 Safari/537.36
    insecure: false
  feed:
    title: title
    description: span.breadcrump-leaf
    authorname: ""
    authoremail: ""
  item:
    container: li[class='ad-listitem lazyload-item   ']
    title: |
      title = sel:find("h2.text-module-begin"):first():text():gsub("^%s*(.-)%s*$", "%1")
      print(title)
    link: |
      link = sel:find("a"):first():attr("href")
      print("https://www.ebay-kleinanzeigen.de" .. link)
    created: |-
      created = ""
      sel:find("div.aditem-main--top--right"):each(function(i, s)
        created = s:text():gsub("^%s*(.-)%s*$", "%1")
      end)
      if created:match("Heute") then
        time = created:gsub("^.*,", "")
        print(os.date("%d.%m.%Y") .. time .. " CET")
        return
      end
      if created:match("Gestern") then
        time = created:gsub("^.*,", "")
        print(os.date("%d.%m.%Y", os.time()-24*60*60) .. time .. " CET")
        return
      end
      if created:match("\.") then
        print(created .. " 00:00 CET")
        return
      end
    createdformat: 02.01.2006 15:04 MST
    description: |-
      description = sel:find(".aditem-main--middle"):html()
      print(description)
    content: ""
    image: |
      img = sel:find("div.imagebox"):first():attr("data-imgsrc")
      if img ~= "" then
        -- prepend host if needed
        if not(img:match("https*:\/\/.*")) then
          img = "https://www.ebay-kleinanzeigen.de" .. img
        end
        print(img)
      end
  nextpage: |
    nextpage = sel:find("link[rel=next]"):attr("href")
    print("https://www.ebay-kleinanzeigen.de" .. nextpage)
  nextpagecount: 5
  sort: ""
-- 
2.34.1
Reply to thread Export thread (mbox)