UnkwUsr / ticked

Edit your ticktick.com tasks from any text editor you want (like vim/neovim)
MIT License
19 stars 0 forks source link

[Feature Request] CLI to Show Today's Tasks? #1

Closed AlJohri closed 7 months ago

AlJohri commented 1 year ago

I understand no future work is planned, but I wanted to throw a feature request out there to see if you are interested in adding this to ticked.

I would like a simple CLI for ticktick to get a list of my tasks for today. This will make it easy to integrate with tools like Übersicht to create macOS desktop widgets.

Do you think something like this is in scope for ticked?

UnkwUsr commented 1 year ago

Hello and sorry for late response. You can solve this task with simple curl+jq in bash:

#!/bin/bash

# extract cookie named "t" from ticktick in browser, this is long string, about
# 300 symbols
TICK_COOKIE='154B...'

curl 'https://api.ticktick.com/api/v2/batch/check/0' \
  -H 'accept: application/json, text/plain, */*' \
  -H "cookie: t=$TICK_COOKIE" \
  --compressed \
  | jq '.syncTaskBean.update.[] ' \
  | jq '{title, content, dueDate}' \
  | jq 'select(.dueDate != null)'
  # or merge all jq's to one command:
  # | jq '.syncTaskBean.update.[] | {title, content, dueDate} | select(.dueDate != null)'

Output example:

$ ./script.sh
{
  "title": "task name/title there",
  "content": "task description/content there",
  "dueDate": "2023-09-15T21:00:00.000+0000"
}
{
  "title": "one more task",
  "content": null,
  "dueDate": "2023-09-15T21:00:00.000+0000"
}

Play with jq output format, process fields, filter. Do anything you want. This is very easy :D

lyleberman commented 11 months ago

This is EXACTLY what I want to do. Thank you! This is great!

lyleberman commented 11 months ago

I really need the project names too. I have the ProjectIds but no correpsonding names. Do you perhaps know how pull that list of IDs and Names out of the API?

lyleberman commented 11 months ago

curl -s 'https://api.ticktick.com/api/v2/projects' - working on the jq command to pull out "id" and "name"