freshrss2linkding/freshrss2linkding.py

37 lines
921 B
Python
Raw Permalink Normal View History

2024-11-12 22:53:17 +01:00
"""Transfer starred items in FreshRSS to Linkding."""
from linkding import Linkding
from freshrss import FreshRss
from helpers import read_config_file
def main():
"""Entry point."""
config = read_config_file()
freshrss = FreshRss(
config['freshrss_url'],
config['freshrss_username'],
config['freshrss_api_password'],
)
freshrss.get_auth_token()
starred = freshrss.get_starred()['items']
items = freshrss.parse_items(starred)
print(f"Found {len(items)} starred items that will be moved to Linkding.")
linkding = Linkding(config['linkding_url'], config['linkding_api_key'])
for item in items:
print(f"Migrating item '{item['title']}'")
linkding.add(
item['url'],
title=item['title'],
tag_names=item['categories']
)
freshrss.unstarr(item['id'])
if __name__ == "__main__":
main()