create script to scrape list of lists and scrape aech into a yaml
parent
1b1724bea7
commit
64868bdc0b
|
|
@ -0,0 +1,21 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
main() {
|
||||||
|
cd "$(dirname "$BASH_SOURCE")"
|
||||||
|
source ./from_todo_server_to_pttodo.sh
|
||||||
|
type from_todo_server_to_pttodo_main
|
||||||
|
list_lists | jq .list[] | jq -c . | while read -r line; do
|
||||||
|
local name="$(echo "$line" | jq -r .name | sed 's/^Today$/todo/g' | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')"
|
||||||
|
local id="$(echo "$line" | jq -r .id)"
|
||||||
|
echo $name, $id
|
||||||
|
TODO_SERVER_LIST="$id" from_todo_server_to_pttodo_main > ./$name.yaml
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
list_lists() {
|
||||||
|
todo_server_curl "$TODO_SERVER_URL/ajax.php?loadLists=&rnd=0.9900282499544026"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$0" == "$BASH_SOURCE" ]; then
|
||||||
|
main "$@"
|
||||||
|
fi
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
TODO_SERVER_URL="${TODO_SERVER_URL:-"https://todo-server.remote.blapointe.com"}"
|
export TODO_SERVER_URL="${TODO_SERVER_URL:-"https://todo-server.remote.blapointe.com"}"
|
||||||
TODO_SERVER_HEADERS="${TODO_SERVER_HEADERS:-"Cookie: BOAuthZ=$TODO_SERVER_BOAUTHZ"}"
|
export TODO_SERVER_HEADERS="${TODO_SERVER_HEADERS:-"Cookie: BOAuthZ=$TODO_SERVER_BOAUTHZ"}"
|
||||||
TODO_SERVER_LIST="${TODO_SERVER_LIST:-"2548023766"}"
|
export TODO_SERVER_LIST="${TODO_SERVER_LIST:-"2548023766"}"
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
from_todo_server_to_pttodo_main "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
from_todo_server_to_pttodo_main() {
|
||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
local tasks_in_todo="$(fetch_tasks_in_list | format_tasks_in_list)"
|
local tasks_in_todo="$(fetch_tasks_in_list | format_tasks_in_list)"
|
||||||
|
|
@ -28,6 +32,10 @@ format_tasks_in_list() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch_tasks_in_list() {
|
fetch_tasks_in_list() {
|
||||||
|
todo_server_curl "$TODO_SERVER_URL/ajax.php?loadTasks=&list=$TODO_SERVER_LIST&compl=${COMPL:-0}&looping=${LOOPING:-0}"
|
||||||
|
}
|
||||||
|
|
||||||
|
todo_server_curl() {
|
||||||
local csv_headers="$TODO_SERVER_HEADERS"
|
local csv_headers="$TODO_SERVER_HEADERS"
|
||||||
local headers=()
|
local headers=()
|
||||||
while [ "$csv_headers" != "" ]; do
|
while [ "$csv_headers" != "" ]; do
|
||||||
|
|
@ -39,7 +47,7 @@ fetch_tasks_in_list() {
|
||||||
csv_headers=""
|
csv_headers=""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
curl -sS "${headers[@]}" "$TODO_SERVER_URL/ajax.php?loadTasks=&list=$TODO_SERVER_LIST&compl=${COMPL:-0}&looping=${LOOPING:-0}"
|
curl -sS "${headers[@]}" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$0" == "$BASH_SOURCE" ]; then
|
if [ "$0" == "$BASH_SOURCE" ]; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue