mathisdt / nextcloud-news-filter Goto Github PK
View Code? Open in Web Editor NEWautomatically mark some items as read in Nextcloud News
License: GNU General Public License v3.0
automatically mark some items as read in Nextcloud News
License: GNU General Public License v3.0
I (seemingly) randomly started seeing failures when the script is run if a feedId is not specified.
(condensed to one filter - this error occurs on all filters, regardless whether an article is found that matches the filter or not)
[login]
address = https://xxx.xxx.com
username = xxx
password = xxx
# Optional parameters:
#
# feedId: restrict rule to just this feed.
# ex: feedId = 51
#
# titleRegex: apply rule to article title
# ex: titleRegex = \bCOLOR\b (use \b to trap word boundaries)
#
# bodyRegex: apply rule to article body
# ex: bodyRegex = \bCOLOR\b (use \b to trap word boundaries)
#
# hoursAge: apply rule if "pubDate" is older than this
# ex: hoursAge = 72
[ALL-Sonos]
titleRegex = \bsonos\b
2024-02-22 14:04:30,428 - root - DEBUG - starting run
2024-02-22 14:04:30,430 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): xxx.xxx.com:443
2024-02-22 14:04:30,568 - urllib3.connectionpool - DEBUG - xxx.xxx.com:443 "GET /index.php/apps/news/api/v1-3/items HTTP/1.1" 200 77326
Traceback (most recent call last):
File "/home/xxx/nextcloud-news-filter/main.py", line 72, in <module>
or one_filter['titleRegex'].search(item['title'])) \
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'
Hi,
I followed the instruction to enable the filtering.
I run nextcloudpi in a lxc container in my mini pc running proxmox.
Using this guide (https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html)
I added the second row in my cron file
*/5 * * * * php -f /var/www/nextcloud/cron.php
*/5 * * * * /usr/bin/php -f /var/www/nextcloud/cron.php ; ( /home/nextcloud-news-filter/main.py | grep -E '(filter|marking as read)' >>/home/nextcloud-news-filter/nextcloud-news-filter.log )
(config.ini and main.py are in my home folder
)
I waited almost 24 hours but I checked and nothing happens.
This is my config.ini
[login]
address = https://cloud.xxxxxx.it
username = xxxx
password = xxxx
# The names of the following sections are not specified, use as description of the filter.
# optional parameter feedId -> apply only in this feed
# optional parameter titleRegex -> apply to item titles
# optional parameter bodyRegex -> apply to item bodies
# optional parameter hoursAge -> apply if item's "pubDate" is older than this
[example 1: filter in feed BLAH]
feedId = 23
titleRegex = unwanted.*juventus
[example 2: filter ads in all feeds]
bodyRegex = (advertisement|paid content)
[example 3: older than 72 hours]
hoursAge = 72
Does it looks right?
An important info: my username is protected by 2 factor auth (so I put a numeric code after login). Maybe is this the reason why it does not work?
Unfortunately the log file is created but is empty.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.