Linusp / python-inoreader

Python wrapper of Inoreader API
65 stars 18 forks source link

Support for the cli option to add feeds #25

Closed rguhr closed 9 months ago

rguhr commented 9 months ago

Would be great if we cloud use the tool to add feeds via command line

@pinlin168 seems to have already built something with the quickadd function and a file with urls into his fork: https://github.com/Linusp/python-inoreader/compare/master...pinlin168:python-inoreader:master

With quickadd you can not specify a folder/label. Think the way via edit is more useful. https://www.inoreader.com/developers/edit-subscription

Maybe something like this? inoreader edit-subscriptions --action follow --streamid https://hnrss.org/newest inoreader edit-subscriptions --action follow --streamid https://hnrss.org/newest --folder user/-/label/Tech (or a short form like Tech only?)

Linusp commented 9 months ago

@rsguhr Thank you for your great advice! I implemented as you suggested.

The code is here: https://github.com/Linusp/python-inoreader/pull/26

rguhr commented 9 months ago

Perfect , worked like a charm :)

I tested follow, unfollow and add-folder

But I have one question: Why is setting the folder/label only allowed during the action add-folder?

    add_folder = folder if action == 'add-folder' else None
    if folder and not folder.startswith('user/-/label/'):
        folder = client.GENERAL_TAG_TEMPLATE.format(folder)

    remove_folder = folder if action == 'remove-folder' else None

_(Should add_folder moved further down to remove_folder - to make sure that the correct value is added to add_folder? (My Python knowledge is limited - please ignore if this is nonsense :D )_

In my ugly bash script I use the folder parameter with the subscribe (old name for follow) action. Therefore I know that it is possible to specify the folder directly when adding a feed without an extra step.

Linusp commented 9 months ago

I've fixed it. Thanks for the test!