Skip to content
Open
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
47 changes: 47 additions & 0 deletions src/articlecrawler/crawldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,52 @@
],
'regex-filter': ['.*[a-z]+.*$']
}
},
'bloomberg': {
'url-prefix': 'https://www.bloomberg.com',
'article-links': {
'overview-urls': ['/markets', '/technology', '/politics', '/world'],
'find-tags': [ # Hierarchy
{'type': 'include', 'name': 'header', 'attrs': {'class': 'story-package-module_ _stories'}},
Copy link
Copy Markdown
Owner

@ywcb00 ywcb00 May 11, 2023

Choose a reason for hiding this comment

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

This configuration seems not to find any article links since there is no container named 'header' in the html page of bloomberg.com. You might have forgotten to change the container name in this line (copy-paste mistake?).

{'type': 'include', 'name': 'a', 'attrs': {'class': 'story-package-module_ _story_ _headline-link'}}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The crawler cannot handle multiple class definitions separated with whitespaces. Either try to pass an array (untested) or reduce these specifications.

],
'link-prefix': ('/news/articles/')
},
'heading': {
'find-tags': [ # Hierarchy
{'type': 'include', 'name': 'h1', 'attrs': {'class': 'lede-text-v2_ _hed'}}
]
},
'article': {
'find-tags': [ # Hierarchy
{'type': 'include', 'name': 'div', 'attrs': {'class': 'body-copy-v2 fence-body'}},
{'type': 'include', 'name': 'p', 'attrs': {}},
{'type': 'excludeParent', 'name': 'div', 'attrs': {'class': 'bb-unsupported-inset'}},
],
'regex-filter': ['.*[a-z]+.*$']
}
},
'washingtonpost': {
'url-prefix': 'https://www.washingtonpost.com',
'article-links': {
'overview-urls': ['/politics', '/world', '/business', '/technology', '/sports'],
'find-tags': [ # Hierarchy
{'type': 'include', 'name': 'header', 'attrs': {'class': 'headline'}},
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Same here.

{'type': 'include', 'name': 'a', 'attrs': {}}
],
'link-prefix': ('/2023/05/')
},
'heading': {
'find-tags': [ # Hierarchy
{'type': 'include', 'name': 'h1', 'attrs': {'data-qa': 'headline'}}
]
},
'article': {
'find-tags': [ # Hierarchy
{'type': 'include', 'name': 'article', 'attrs': {'itemprop': 'articleBody'}},
{'type': 'include', 'name': 'p', 'attrs': {}},
],
'regex-filter': ['.*[a-z]+.*$']
}
}
}