Skip to content

Instantly share code, notes, and snippets.

Avatar
🐍

Illia Pyshniak cor-bee

🐍
View GitHub Profile
@cor-bee
cor-bee / medium_iv.yaml
Created Feb 10, 2020
IV Template for Medium based on Sample Template with NESTED_ELEMENT_ERROR Handler
View medium_iv.yaml
# This sample template explores how we can turn the Medium post on the left into a Telegram Instant View page as shown on the right — in several simple steps. If you're unsure what some of the elements used here do, check out the full documentation here: https://instantview.telegram.org/docs
# Place the version at the beginning of template. We recommend always using the latest available version of Instant View.
~version: "2.1"
### STEP 1: Define which pages get Instant View and which don't
# We only want to generate Instant View pages for articles. Other things, like lists of articles, profiles, the about section, etc. should be ignored.
# Conveniently, all article pages on Medium seem to have a <meta property="article:published_time"> tag.
# If this tag is not present, we'll assume that the page is not an article and does not require an Instant View page.
@cor-bee
cor-bee / WebPageExample.c
Last active Jan 16, 2020
WebPageExample
View WebPageExample.c
//Reponse to GetWebPageRequest(url='https://www.quantamagazine.org/unscrambled-eggs-self-organization-restores-cells-order-20200102/')
WebPage(
id=8925637109568550576,
url='https://www.quantamagazine.org/unscrambled-eggs-self-organization-restores-cells-order-20200102/',
display_url='quantamagazine.org/unscrambled-eggs-self-organization-restores-cells-order-20200102',
hash=-167896122,
type='photo',
site_name='Quanta Magazine',
title='Unscrambled Eggs: Self-Organization Restores Cells’ Order',
description='To scientists’ surprise, blended mixtures of cytoplasm can reorganize themselves into cell-like compartments with working structural components.',
View 1_NESTED_ELEMENT_NOT_SUPPORTED.yaml
# NESTED_ELEMENT_NOT_SUPPORTED Error Handler
?true
$problems: $body
@while( $problems ) {
$test: $body//*[self::*[has-class("fb-post")] or self::blockquote or self::aside or self::figure or self::img[not(./ancestor::figure)] or self::iframe[not(./ancestor::figure)] or self::script[@data-telegram-post] or self::slideshow[not(./ancestor::figure)] or self::video[not(./ancestor::figure)] or self::audio[not(./ancestor::figure)] or self::related or self::footer or self::table[not(ancestor::table) and not(descendant::table)]]
$problems: $test/self::*[ancestor::anchor or ancestor::blockquote[not(contains(@class,"instagram"))] or ancestor::aside or ancestor::footer or ancestor::strong or ancestor::b or ancestor::em or ancestor::i or ancestor::ins or ancestor::u or ancestor::del or ancestor::s or ancestor::strike or ancestor::code or ancestor::kbd or ancestor::samp or ancestor::tt or ancestor::mark or ancestor::sup or ancestor::pic or ancestor::sub or ancestor::a or ancestor::reference or ancestor::h1 or ancestor::
View dev.to.yaml
## General info:
# Function starts with @
# Variable starts with $
# Return of the most recently run function made by $@
# Key comments marked with ##
## Version of IV must be set first
~version: "2.1"
# Telegram doesn't support JW Player which is used in videoheaders
You can’t perform that action at this time.