Save Pocket bookmarks to file on GitHub
Small script that gets links that are added to Pocket, and pushes new changes to a file on GitHub.
How does it work?
- I save articles I want to read on pocket.
- On my server, I have a cronjob that runs a small script (main.py) that checks if anything new is added to my pocket list with the tag ‘public’.
- If it finds something that was not added to my bookmarks page yet, it adds the new link to the file that contains my bookmarks and commits and pushes it to GitHub.
- GitHub Pages makes sure that the new change is deployed to this website automatically.
Installation
- Clone the repository
- Create an app on pocket, store its consumer key
- Install the requirements (just
python-dotenv
andclick
)
pip install -r requirements.txt
- Create an environment file (
cp .env.example .env
). Add your GitHub access code and Pocket consumer key - Run
python pocket_handler.py
and save theaccess_token
to your.env
file. - Add an
input_separator
to you.env
file. The script will try to add new links after this point in your file. For example, I use<ul>
as my input separator, and add new a<li>
after that for each new link. You can change this setup inmain.py
add_bookmark()
.
You should now be able to run python main.py
with the required input
How to use
Once installed, you can call main.py
with the following parameters:
python main.py -i {file_to_edit} -r {repository_of_file}
This fetches your latest additions to Pocket, adds them to the specified file and commits and pushes that change to GitHub.