freshrss2pocket/freshrss2pocket.py

37 lines
879 B
Python

"""Transfer YouTube subscriptions to FreshRSS."""
from pocket import Pocket
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 Pocket.")
pocket = Pocket(config['pocket_consumer_key'])
for item in items:
print(f"Migrating item '{item['title']}'")
pocket.add(
item['url'],
title=item['title'],
tags=item['categories']
)
freshrss.unstarr(item['id'])
if __name__ == "__main__":
main()