Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1111 from contribucious/contribucious-fix/hls-syn…
Browse files Browse the repository at this point in the history
…tax-and-examples-fixes

fix `$hls` syntax and examples
  • Loading branch information
ameshkov authored Aug 7, 2022
2 parents 65cab1f + 4aeb528 commit ac56f46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions 01.general/02.how-to-create-your-own-ad-filters/docs.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -1223,13 +1223,13 @@ Note that the word "segment" in this document means either a "Media Segment" or

##### Syntax
* `||example.org^$hls=urlpattern` – remove segments whose URL matches the URL pattern `urlpattern`. The pattern works just like the one in basic URL rules, however, the characters `/`, `$` and `,` must be escaped with `\` inside `urlpattern`.
* `||example.org^$hls=/regex/options` – remove segments where the URL, or, if a certain option is present, one of the tags, matches the regular expression `regex`. `options` modify the behaviour of the rule as described below.
* `||example.org^$hls=/regexp/[options]` – remove segments where the URL, or, if a certain option is present, one of the tags, matches the regular expression `regexp`. `[options]` modify the behaviour of the rule as described below.

Available `options` are:
* `t` – instead of testing the segment's URL, test each of the segment's tags against the regex. A segment with a matching tag is removed.
* `t` – instead of testing the segment's URL, test each of the segment's tags against the regular expression. A segment with a matching tag is removed.
* `i` – make the regular expression case-insensitive.

The characters `/`, `$` and `,` must be escaped with `\` inside `regex`.
The characters `/`, `$` and `,` must be escaped with `\` inside `regexp`.

##### Exceptions

Expand All @@ -1250,7 +1250,7 @@ When multiple `$hls` rules match the same request, their effect is cumulative.
##### Examples
* `||example.org^$hls=\/videoplayback^?*&source=dclk_video_ads` — removes all segments with the matching URL.
* `||example.org^$hls=/\/videoplayback\/?\?.*\&source=dclk_video_ads/i` — achieves more or less the same with
a regex instead of a URL pattern.
a regular expression instead of a URL pattern.
* `||example.org^$hls=/#UPLYNK-SEGMENT:.*\,ad/t` — removes all segments which have the matching tag.

##### Anatomy of an HLS playlist
Expand Down
4 changes: 2 additions & 2 deletions 01.general/02.how-to-create-your-own-ad-filters/docs.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -1214,13 +1214,13 @@ $removeparam=/^(utm_content|utm_campaign|utm_referrer)=/

##### Синтаксис
* `||example.org^$hls=urlpattern` – удалить сегменты, URL которых соответствует паттерну `urlpattern`. Паттерн работает так же, как в базовых URL правилах, однако символы `/`, `$` и `,` в составе `urlpattern` необходимо экранировать с помощью `\`.
* `||example.org^$hls=/regex/options` – удалить сегменты, URL которых, или, в зависимости от опций, один из тегов, соответствует регулярному выражению `regex`. Опции `options` изменяют поведение правила как описано ниже.
* `||example.org^$hls=/regexp/[options]` – удалить сегменты, URL которых, или, в зависимости от опций, один из тегов, соответствует регулярному выражению `regexp`. Опции `[options]` изменяют поведение правила как описано ниже.

Доступные значения `options`:
* `t` – вместо URL, тестировать теги сегмента на соответствие регулярному выражению. Сегмент с соответствующим тегом будет удален.
* `i` – сделать регулярное выражение нечувствительным к регистру символов.

Как и в случае с паттерном, символы `/`, `$` и `,` в `regex` необходимо экранировать с помощью `\`.
Как и в случае с паттерном, символы `/`, `$` и `,` в `regexp` необходимо экранировать с помощью `\`.

##### Отключение правил `$hls`

Expand Down

0 comments on commit ac56f46

Please sign in to comment.