-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxpath.txt
65 lines (43 loc) · 1.38 KB
/
xpath.txt
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
~version: "2.1"
site_name: "Мехмат ЮФУ"
title: //h1[has-class("article_title")]
body: //div[has-class("newsitem_text")]
# remove "Автор", then parse name
author: //span[has-class("createby")]/text()[2]
@replace("Автор: ", ""): $author
# remove "Обновлено", then parse date
@inline: //div[has-class("newsitem_info")]/comment()
$date: //span[has-class("modifydate")]
$date?: //span[has-class("createdate")]/text()[2]
@replace("Обновлено: ", ""): $date
@replace("Создано: ", "")
@datetime
published_date: $@
# mark colored spans as bold
@wrap(<b>): //span[starts-with(@style, 'color')]
# hidden emails
$cloaks: //span[starts-with(@id, "cloak")]
@map() {
$c: $@
$s: $c/next-sibling::script
@match("'[^']*?' \\+ '@' \\+ '.*?' \\+ '.' \\+ '.*?'")
@replace("' \\+ '", "")
@replace("^'", "")
@replace("'$", "")
@replace_tag(<a>)
@set_attr(href, "mailto:", ./text())
@remove: $c
}
# remove bad images from the page
# and take one from the article if exists
@remove: //img[has-class("mythumb")]
@remove: //img[contains(@src, "logo_sfedu_white.png")]
@split_parent: //p/br
@split_parent: //span/img
@split_parent: //p/img
@split_parent: //p/figure
image_url: //img/@src
?path: /[^/]*/sunmathevents/.*
image_url: "https://pbs.twimg.com/media/CPV-6O3UwAANiZA.jpg:large"
image_url: "https://i.imgur.com/tQxAcdo.png"
@debug: $image_url