37 lines
921 B
Python
37 lines
921 B
Python
|
"""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()
|