Giter Site home page Giter Site logo

nextcloud-news-filter's Issues

TypeError: expected string or bytes-like object, got 'NoneType'

Summary

I (seemingly) randomly started seeing failures when the script is run if a feedId is not specified.

config.ini setup

(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

Results

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'

Nothing happens : help in config

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
image
)

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.