Setting for Extract <title> as title option on individual watches (#229)

* Extract <title> as title option on individual items
pull/233/head
dgtlmoon 3 years ago committed by GitHub
parent 6901fc493d
commit 25476bfcb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,6 @@
recursive-include changedetectionio/templates *
recursive-include changedetectionio/static *
include changedetection.py
global-exclude *.pyc
global-exclude *.pyc
global-exclude *node_modules*
global-exclude venv

@ -411,7 +411,9 @@ def changedetection_app(config=None, datastore_o=None):
'fetch_backend': form.fetch_backend.data,
'trigger_text': form.trigger_text.data,
'notification_title': form.notification_title.data,
'notification_body': form.notification_body.data
'notification_body': form.notification_body.data,
'extract_title_as_title': form.extract_title_as_title.data
}
# Notification URLs

@ -170,9 +170,10 @@ class perform_site_check():
update_obj["previous_md5"] = fetched_md5
# Extract title as title
if is_html and self.datastore.data['settings']['application']['extract_title_as_title']:
if not watch['title'] or not len(watch['title']):
update_obj['title'] = html_tools.extract_element(find='title', html_content=fetcher.content)
if is_html:
if self.datastore.data['settings']['application']['extract_title_as_title'] or watch['extract_title_as_title']:
if not watch['title'] or not len(watch['title']):
update_obj['title'] = html_tools.extract_element(find='title', html_content=fetcher.content)
return changed_detected, update_obj, stripped_text_from_html

@ -203,6 +203,7 @@ class commonSettingsForm(Form):
notification_body = TextAreaField('Notification Body', default='{watch_url} had a change.', validators=[validators.Optional(), ValidateTokensList()])
trigger_check = BooleanField('Send test notification on save')
fetch_backend = RadioField(u'Fetch Method', choices=content_fetcher.available_fetchers(), validators=[ValidateContentFetcherIsReady()])
extract_title_as_title = BooleanField('Extract <title> from document and use as watch title', default=False)
class watchForm(commonSettingsForm):
@ -225,4 +226,3 @@ class globalSettingsForm(commonSettingsForm):
minutes_between_check = html5.IntegerField('Maximum time in minutes until recheck',
[validators.NumberRange(min=1)])
extract_title_as_title = BooleanField('Extract <title> from document and use as watch title')

@ -73,6 +73,7 @@ class ChangeDetectionStore:
'css_filter': "",
'trigger_text': [], # List of text or regex to wait for until a change is detected
'fetch_backend': None,
'extract_title_as_title': False
}
if path.isfile('changedetectionio/source.txt'):

@ -56,6 +56,9 @@ User-Agent: wonderbra 1.0") }}
<p>The <strong>Chrome/Javascript</strong> method requires a network connection to a running WebDriver+Chrome server. </p>
</span>
</div>
<div class="pure-control-group">
{{ render_field(form.extract_title_as_title) }}
</div>
</fieldset>
</div>

Loading…
Cancel
Save