Skip to content

Commit 44c218d

Browse files
authored
feat: provide defaults for dynamic params (#254)
Closes #252
1 parent 65cf54c commit 44c218d

15 files changed

Lines changed: 79 additions & 10 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@
44

55
This repository contains `html2rss` feed configurations for many websites.
66

7+
## Dynamic Parameters
8+
9+
Configs must include a `parameters` section to define default values for dynamic parameters:
10+
11+
```yaml
12+
parameters:
13+
query:
14+
type: string
15+
default: "technology"
16+
category:
17+
type: string
18+
default: "news"
19+
20+
channel:
21+
url: https://example.com/search?q=%<query>s&cat=%<category>s
22+
# ... rest of config
23+
```
24+
25+
The `type` field specifies the parameter type (currently only `string` is supported), and `default` provides the default value when no parameter is explicitly provided.
26+
727
## Documentation
828

929
- [Main Documentation](https://html2rss.github.io/html2rss-configs/)

lib/html2rss/configs/bbc.co.uk/available_episodes.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
parameters:
2+
id:
3+
type: string
4+
default: "b006wkfp"
5+
16
channel:
27
url: https://www.bbc.co.uk/programmes/%<id>s/episodes/player
38
time_zone: UTC

lib/html2rss/configs/blog.mondediplo.net/feed.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
parameters:
2+
blog:
3+
type: string
4+
default: "-Defense-en-ligne-"
5+
16
channel:
27
url: https://blog.mondediplo.net/%<blog>s
38
time_zone: Europe/Paris

lib/html2rss/configs/github.com/releases.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
parameters:
2+
username:
3+
type: string
4+
default: "nuxt"
5+
repository:
6+
type: string
7+
default: "nuxt.js"
8+
19
channel:
210
url: https://github.com/%<username>s/%<repository>s/releases
311
time_zone: UTC

lib/html2rss/configs/imdb.com/ratings.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
parameters:
2+
user_id:
3+
type: string
4+
default: "ur7019649"
5+
16
channel:
27
url: https://www.imdb.com/user/%<user_id>s/ratings
38
time_zone: UTC

lib/html2rss/configs/spiegel.de/impressum_autor.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
parameters:
2+
id:
3+
type: string
4+
default: "975b6ae0-0001-0003-0000-000000018282"
5+
16
channel:
27
url: "https://www.spiegel.de/impressum/autor-%<id>s"
38
time_zone: Europe/Berlin
@@ -13,7 +18,7 @@ selectors:
1318
url:
1419
selector: "section > a"
1520
extractor: "href"
16-
descripton:
21+
description:
1722
selector: ".leading-loose"
1823
published_at:
1924
selector: "footer"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
RSpec.describe 'apnews.com/hub.yml' do
4-
it_behaves_like 'config.yml', 'apnews.com/hub.yml', section: 'world-news'
4+
it_behaves_like 'config.yml', 'apnews.com/hub.yml'
55
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
RSpec.describe 'bbc.co.uk/available-episodes.yml' do
4-
it_behaves_like 'config.yml', 'bbc.co.uk/available_episodes.yml', id: 'b006wkfp'
4+
it_behaves_like 'config.yml', 'bbc.co.uk/available_episodes.yml'
55
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
RSpec.describe 'blog.mondediplo.net/feed.yml' do
4-
it_behaves_like 'config.yml', 'blog.mondediplo.net/feed.yml', blog: '-Defense-en-ligne-'
4+
it_behaves_like 'config.yml', 'blog.mondediplo.net/feed.yml'
55
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
RSpec.describe 'cnet.com/section_sub.yml' do
4-
it_behaves_like 'config.yml', 'cnet.com/section_sub.yml', section: 'culture', sub: 'internet'
4+
it_behaves_like 'config.yml', 'cnet.com/section_sub.yml'
55
end

0 commit comments

Comments
 (0)