-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathrules.iv
More file actions
31 lines (24 loc) · 951 Bytes
/
rules.iv
File metadata and controls
31 lines (24 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Telegram Instant View rules: https://instantview.telegram.org/
# RHash: 71b64d09b0a20d
# Maintained by: Hung-I WANG <whygowe@gmail.com>
~version: "2.1"
?path: /api/readability\?url=(.+)(?!=json)
body: //body
@remove: $body//header
# Fix: Element <img> is not supported in <p>:
# https://stackoverflow.com/questions/54969371/telegrams-instant-view-api-element-img-is-not-supported-in-p
@replace_tag(<figure>): $body//p[.//img]
# To fix: Element <img> is not supported in <a>
# From: https://stackoverflow.com/questions/55076621/element-img-is-not-supported-in-a
@split_parent: //a/img
# @split_parent: //p/img
@split_parent: //strong/img
@split_parent: //td/img
# Generate `figure>img` by cloning and manipulating `meta[property="og:image"]` and take it as the cover.
@clone: (/html/head/meta[@property="og:image"])[0]
@replace_tag("<img>"): $@
@before_el(//article): $@
$i: $@
@set_attr("src", @content): $@
@wrap("<figure>"): $i
cover: $@