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 | package Torello.HTML.Tools.NewsSite;
import static Torello.Java.C.YELLOW;
import static Torello.Java.C.RESET;
import Torello.HTML.Util;
import Torello.HTML.NodeSearch.TagNodeGetInclusive;
import java.io.IOException;
class ScrapeTitle
{
static void run(final RECORD r) throws IOException
{
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// Retrieve the <TITLE> element (as a String) from the page - if it has one.
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
r.title = Util.textNodesString(TagNodeGetInclusive.first(r.page, "title"));
if (r.title.length() > 0) r.log.append
("\tPage <TITLE> element is: " + YELLOW + r.title + RESET + '\n');
else
r.log.append("\tPage has no <TITLE> element, or it was empty.\n");
}
}
|