Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This is an example Instantview for the presse-eifel.de website
~version: "2.0"
# this IV is a pretty basic example for a pretty basic website. LET'S GO
?exists: //meta[@content="article"]
# very easy way to determine if our IV should be generated or not. Works well.
body: //article
title: $body//h1[1]
channel: "@PresseEifel"
# basic variables, its their official channel, so we set it as well.
author: //a[@rel="author"]
author_url: //a[@class="url fn n"]/@href
# its only Presse-Eifel so long, but who knows, maybe this is going to change
@remove: //p[@class="postmetadata"]
@remove: //p[@class="categories"]
@remove: //div[@class="writer"]
# This removes unnecessary parts of our target website.
@before(" "): $body//p/text()[not(ends-with(., ' '))]/next-sibling::br
@remove: //br
@replace("\u00a0", ""): //p/text()
# This is actually a very special case. Our website likes to put random breaks in its paragraphs. So we just replace them with spaces and then remove whitespaces which are also there for a weird reason. Moving on.
@remove: $body//img[has-class("crazy_lazy")]
@before_el("./../self::figcaption"): //noscript
# A great way to get images which aren't loaded directly for the user. Now they are in our IV
$cover_path: //meta[@property="og:image"]
@set_attr(src, @content)
@replace_tag(<img>)
cover
# Nice little way to set this (on the main site invisible) cover. We take it from the open graph tag, put the content attribute as the src one and then replace the meta tag with the img. After that, we only need to set it as our cover.
# AND WE ARE DONE. Thanks for your attention.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.