Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@

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

## Dynamic Parameters

Configs must include a `parameters` section to define default values for dynamic parameters:

```yaml
parameters:
query:
type: string
default: "technology"
category:
type: string
default: "news"

channel:
url: https://example.com/search?q=%<query>s&cat=%<category>s
# ... rest of config
```

The `type` field specifies the parameter type (currently only `string` is supported), and `default` provides the default value when no parameter is explicitly provided.

## Documentation

- [Main Documentation](https://html2rss.github.io/html2rss-configs/)
Expand Down
5 changes: 5 additions & 0 deletions lib/html2rss/configs/bbc.co.uk/available_episodes.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
parameters:
id:
type: string
default: "b006wkfp"

channel:
url: https://www.bbc.co.uk/programmes/%<id>s/episodes/player
time_zone: UTC
Expand Down
5 changes: 5 additions & 0 deletions lib/html2rss/configs/blog.mondediplo.net/feed.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
parameters:
blog:
type: string
default: "-Defense-en-ligne-"

channel:
url: https://blog.mondediplo.net/%<blog>s
time_zone: Europe/Paris
Expand Down
8 changes: 8 additions & 0 deletions lib/html2rss/configs/github.com/releases.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
parameters:
username:
type: string
default: "nuxt"
repository:
type: string
default: "nuxt.js"

channel:
url: https://github.com/%<username>s/%<repository>s/releases
time_zone: UTC
Expand Down
5 changes: 5 additions & 0 deletions lib/html2rss/configs/imdb.com/ratings.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
parameters:
user_id:
type: string
default: "ur7019649"

channel:
url: https://www.imdb.com/user/%<user_id>s/ratings
time_zone: UTC
Expand Down
7 changes: 6 additions & 1 deletion lib/html2rss/configs/spiegel.de/impressum_autor.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
parameters:
id:
type: string
default: "975b6ae0-0001-0003-0000-000000018282"

channel:
url: "https://www.spiegel.de/impressum/autor-%<id>s"
time_zone: Europe/Berlin
Expand All @@ -13,7 +18,7 @@ selectors:
url:
selector: "section > a"
extractor: "href"
descripton:
description:
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed typo: 'descripton' has been corrected to 'description'.

Copilot uses AI. Check for mistakes.
selector: ".leading-loose"
published_at:
selector: "footer"
Expand Down
2 changes: 1 addition & 1 deletion spec/html2rss/configs/apnews.com/hub.yml_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

RSpec.describe 'apnews.com/hub.yml' do
it_behaves_like 'config.yml', 'apnews.com/hub.yml', section: 'world-news'
it_behaves_like 'config.yml', 'apnews.com/hub.yml'
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

RSpec.describe 'bbc.co.uk/available-episodes.yml' do
it_behaves_like 'config.yml', 'bbc.co.uk/available_episodes.yml', id: 'b006wkfp'
it_behaves_like 'config.yml', 'bbc.co.uk/available_episodes.yml'
end
2 changes: 1 addition & 1 deletion spec/html2rss/configs/blog.mondediplo.net/feed.yml_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

RSpec.describe 'blog.mondediplo.net/feed.yml' do
it_behaves_like 'config.yml', 'blog.mondediplo.net/feed.yml', blog: '-Defense-en-ligne-'
it_behaves_like 'config.yml', 'blog.mondediplo.net/feed.yml'
end
2 changes: 1 addition & 1 deletion spec/html2rss/configs/cnet.com/section_sub.yml_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

RSpec.describe 'cnet.com/section_sub.yml' do
it_behaves_like 'config.yml', 'cnet.com/section_sub.yml', section: 'culture', sub: 'internet'
it_behaves_like 'config.yml', 'cnet.com/section_sub.yml'
end
2 changes: 1 addition & 1 deletion spec/html2rss/configs/github.com/releases.yml_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

RSpec.describe 'github.com/releases.yml' do
it_behaves_like 'config.yml', 'github.com/releases.yml', username: 'nuxt', repository: 'nuxt.js'
it_behaves_like 'config.yml', 'github.com/releases.yml'
end
2 changes: 1 addition & 1 deletion spec/html2rss/configs/imdb.com/ratings.yml_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

RSpec.describe 'imdb.com/ratings.yml' do
it_behaves_like 'config.yml', 'imdb.com/ratings.yml', user_id: 'ur7019649'
it_behaves_like 'config.yml', 'imdb.com/ratings.yml'
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

RSpec.describe 'spiegel.de/impressum_autor.yml' do
it_behaves_like 'config.yml', 'spiegel.de/impressum_autor.yml', id: '975b6ae0-0001-0003-0000-000000018282'
it_behaves_like 'config.yml', 'spiegel.de/impressum_autor.yml'
end
2 changes: 1 addition & 1 deletion spec/html2rss/configs/webentwickler-jobs.de/in.yml_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

RSpec.describe 'webentwickler-jobs.de/in.yml' do
it_behaves_like 'config.yml', 'webentwickler-jobs.de/in.yml', region: 'berlin'
it_behaves_like 'config.yml', 'webentwickler-jobs.de/in.yml'
end
23 changes: 22 additions & 1 deletion spec/support/shared_examples/config.yml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@
config = {}.merge Html2rss::Configs.find_by_name(feed_name)

config.merge!(global_config.dup)
config[:params] = params if params

# Use provided params or extract defaults from parameters section
if params
config[:params] = params
elsif config[:parameters]
default_params = {}
config[:parameters].each do |param_name, param_config|
default_params[param_name] = param_config[:default] if param_config[:default]
end
config[:params] = default_params unless default_params.empty?
end

config
end

Expand Down Expand Up @@ -61,6 +72,16 @@
end
end

context 'with parameters present' do
it 'has valid parameter definitions', :aggregate_failures do
yaml['parameters']&.each do |param_name, param_config|
expect(param_config).to be_a(Hash), "parameter `#{param_name}` should be a hash"
expect(param_config['type']).to eq('string'), "parameter `#{param_name}` should have type 'string'"
expect(param_config['default']).not_to be_nil, "parameter `#{param_name}` should have a default value"
end
end
end

context 'with selectors present' do
it 'has required selectors', :aggregate_failures do
%w[items title].each do |required_attribute|
Expand Down