Expand description
What a web page says of itself, for showing under a note that links to it: its title, a few words about it, and a picture.
Pages say this in the meta tags of their head, most of them as Open
Graph (og:title, og:description, og:image), which is what other
clients and every chat program read. Only the head is fetched and read,
with a tokenizer: nothing of the page is run, laid out or kept.
A link that answers as a video, where a page was asked for, is one the
address did not give away: the answer is Linked::Video, and the
row offers to play it (see crate::video).
A YouTube video is asked what it is called the short way (see
Video::about): its page says so too,
most of a megabyte in.
A view asks the PreviewStore for the preview of an address, as it
asks for pictures (see Requests): the app hears of it as a
Message::LoadPreview. A page
is asked once in a run, whatever it answers. There is no disk cache.
Addresses come from whoever wrote a note. They are fetched as everything
is (see crate::http): the pageβs server sees the request, as the
server of a noteβs picture does.
StructsΒ§
- Link
Preview - What a web page says of itself.
- Preview
Store - What the pages asked about so far say of themselves, by address. See the module docs.
- Said π
- What the head of a page says of the page, as it was found: each thing
said the way most trusted to be meant for sharing. A lower
rankis more trusted, and among equals the first one said stands.
EnumsΒ§
- Linked
- What a link a note took for a page turned out to be.
- Preview
State - What the store has to say about the preview of a page.
ConstantsΒ§
- DESCRIPTION_
MAX_ πCHARS - MAX_
ABOUT_ πBYTES - How much of what YouTube answers about a video is read: it is a few hundred bytes.
- MAX_
HEAD_ πBYTES - How much of a page is read looking for the end of its head. Most heads end within a few thousand bytes; some sites put a megabyte of script before what they say of themselves.
- MAX_
IN_ πFLIGHT - How many pages may be on their way at once, and how many requests may wait between a view asking and the app answering.
- REQUEST_
QUEUE π - TITLE_
MAX_ πCHARS - How many characters of a title and of a description are kept: more than a preview has room to show.
FunctionsΒ§
- fetch
- Fetch the head of the page at
urland read what the page says of itself; or hear that it is a video, and fetch none of it. - one_
line π textas one line: runs of blank space and line breaks made one space, none at either end, andmax_charscharacters at most.Noneif that leaves nothing, or if the text was not read as it was written: a page that is not in UTF-8 says nothing rather than something garbled.- parse
- What the page at
urlsays of itself inhtml, which is its head, or starts with it.Noneif it gives itself no title: there is nothing to call it by.