<commit_before># A bit opinionated titlefetching

```
load Web
config plugins.web.snarfMultipleUrls True
config plugins.web.snarferShowDomain False
config plugins.web.snarferShowTargetDomain False
config channel #CHAN plugins.web.titleSnarfer True
config supybot.protocols.http.userAgents "Limnoria UrlPreviewBot"
config supybot.protocols.http.peekSize 1048576
```

* enables the plugin (shipped with Limnoria)
* enables titlefetching for all links on line, not just the first one
* disables showing domain (small protection against multiple titlesnarfers entering loop)
* disables showing redirect target -||-
* enables titlefetching per-channel (avoids unwanted channels in case of botloop)
  * could also be `config config` or `config network NETWORKNAME` to do globally or per-network, but risk of accidental botloop
* sets user-agent to "Limnoria UrlPreviewBot" instead of ['Mozilla/5.0 (compatible; utils.web python module)' from 2005](https://github.com/ProgVal/Limnoria/blame/2990fcd302afdc6a3b741594017c3959fd5da2fd/src/utils/web.py#L120)
  * I have heard that it's bad to pretend to be something you aren't and Twitter will only give you HTMl `<title>`s if your user-agent contains `UrlPreviewBot`
* search for html titles from the first MEGABYTE of the webpage as modern web is horrible (looking at you hs.fi & youtube.com)<commit_msg>titlefetching: separate enabling, fleshen it & cut lines<commit_after># A bit opinionated titlefetching

## Preparation

```
load Web
config plugins.web.snarfMultipleUrls True
config plugins.web.snarferShowDomain False
config plugins.web.snarferShowTargetDomain False
config supybot.protocols.http.userAgents "Limnoria UrlPreviewBot"
config supybot.protocols.http.peekSize 1048576
```

* enables the plugin (shipped with Limnoria)
* enables titlefetching for all links on line, not just the first one
* disables showing domain (small protection against multiple titlesnarfers
  entering loop)
* disables showing redirect target -||-
* sets user-agent to "Limnoria UrlPreviewBot" instead of ['Mozilla/5.0 (compatible; utils.web python module)' from 2005](https://github.com/ProgVal/Limnoria/blame/2990fcd302afdc6a3b741594017c3959fd5da2fd/src/utils/web.py#L120)
  * I have heard that it's bad to pretend to be something you aren't and
    Twitter will only give you HTMl `<title>`s if your user-agent contains
    `UrlPreviewBot`
* search for html titles from the first MEGABYTE of the webpage as modern
  web is horrible (looking at you hs.fi & youtube.com)

## Actually enabling it

```
config channel #CHAN plugins.web.titleSnarfer True
```

* enables titlefetching per-channel, on #CHAN to be accurate
  (avoiding unwanted channels in case of botloop)
  * `"channel #CHAN"` could also be replaced with `network NETWORKNAME` for
    every channel on network or `config` (or omitted entirely) for
    everywhere (channel takes priority over network which *probably takes*
    priority over global)
{'fraction_non_alphanumeric': 0.07339449541284404, 'fraction_numerical': 0.027183146449201494, 'mean_word_length': 5.250530785562633, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '335282', 'n_tokens_mistral': 931, 'n_tokens_neox': 862, 'n_words': 327}