cleaning this all up a bit further...
This commit is contained in:
parent
75fc007618
commit
02964ebf92
4 changed files with 67 additions and 24 deletions
|
|
@ -59,3 +59,10 @@
|
||||||
- name: "Print Result of Unknown Request"
|
- name: "Print Result of Unknown Request"
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ account_whatever }}"
|
msg: "{{ account_whatever }}"
|
||||||
|
|
||||||
|
- name: "Print important IDs"
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg:
|
||||||
|
- "Please save the following IDs:"
|
||||||
|
- "aid: {{ aid }}"
|
||||||
|
- "mysterious_id: {{ mysterious_id }}"
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,13 @@
|
||||||
Referer: https://www.zuginfo.nrw/
|
Referer: https://www.zuginfo.nrw/
|
||||||
register: webpush_subscription
|
register: webpush_subscription
|
||||||
|
|
||||||
- name: "Create WebPush Subscription"
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ webpush_subscription }}"
|
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
user_id: "{{ webpush_subscription.json.svcResL[0].res.userId }}"
|
user_id: "{{ webpush_subscription.json.svcResL[0].res.userId }}"
|
||||||
|
|
||||||
|
- name: "Print user_id"
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "{{ user_id }}"
|
||||||
|
|
||||||
- name: "Get a Channel ID"
|
- name: "Get a Channel ID"
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrUserDetails&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}"
|
url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrUserDetails&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}"
|
||||||
|
|
@ -42,13 +42,13 @@
|
||||||
Referer: https://www.zuginfo.nrw/
|
Referer: https://www.zuginfo.nrw/
|
||||||
register: channel_id
|
register: channel_id
|
||||||
|
|
||||||
- name: "channel_id"
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ channel_id }}"
|
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
channel_id: "{{ channel_id.json.svcResL[0].res.availableChannels[0].channelId }}"
|
channel_id: "{{ channel_id.json.svcResL[0].res.availableChannels[0].channelId }}"
|
||||||
|
|
||||||
|
- name: "Print channel_id"
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "{{ channel_id }}"
|
||||||
|
|
||||||
- name: "Subscribe to info for S4"
|
- name: "Subscribe to info for S4"
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrCreate&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}"
|
url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrCreate&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}"
|
||||||
|
|
@ -85,3 +85,10 @@
|
||||||
- name: "Result: Verify Subscription"
|
- name: "Result: Verify Subscription"
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ verify_subscription }}"
|
msg: "{{ verify_subscription }}"
|
||||||
|
|
||||||
|
- name: "Print important IDs"
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg:
|
||||||
|
- "Please save the following IDs:"
|
||||||
|
- "user_id: {{ user_id }}"
|
||||||
|
- "channel_id: {{ channel_id }}"
|
||||||
|
|
|
||||||
44
zuginfo_playbooks/zuginfo_api_detail_subscription.yml
Normal file
44
zuginfo_playbooks/zuginfo_api_detail_subscription.yml
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: "Zuginfo.nrw API"
|
||||||
|
hosts: localhost
|
||||||
|
vars:
|
||||||
|
unix_time_millis: "1762342729099"
|
||||||
|
aid: ""
|
||||||
|
mysterious_id: ""
|
||||||
|
user_id: ""
|
||||||
|
subscription_id: ""
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: "List Subscriptions"
|
||||||
|
ansible.builtin.uri:
|
||||||
|
url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrSearch&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}"
|
||||||
|
method: POST
|
||||||
|
body: "{{ lookup('ansible.builtin.template','list_subscriptions.json.j2') }}"
|
||||||
|
headers:
|
||||||
|
Accept-Encoding: gzip, deflate, br, zstd
|
||||||
|
Content-Type: application/json
|
||||||
|
Origin: https://www.zuginfo.nrw/
|
||||||
|
Referer: https://www.zuginfo.nrw/
|
||||||
|
TE: trailers
|
||||||
|
register: list_subscription
|
||||||
|
|
||||||
|
- name: "Print Result: List of Subscriptions"
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "{{ list_subscription }}"
|
||||||
|
|
||||||
|
- name: "Detail Subscriptions"
|
||||||
|
ansible.builtin.uri:
|
||||||
|
url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrUserDetails&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}"
|
||||||
|
method: POST
|
||||||
|
body: "{{ lookup('ansible.builtin.template','detail_subscriptions.json.j2') }}"
|
||||||
|
headers:
|
||||||
|
Accept-Encoding: gzip, deflate, br, zstd
|
||||||
|
Content-Type: application/json
|
||||||
|
Origin: https://www.zuginfo.nrw/
|
||||||
|
Referer: https://www.zuginfo.nrw/
|
||||||
|
register: detail_subscription
|
||||||
|
|
||||||
|
- name: "Print Result: Details of Subscriptions"
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "{{ detail_subscription }}"
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
unix_time_millis: "1762342729099"
|
unix_time_millis: "1762342729099"
|
||||||
aid: ""
|
aid: ""
|
||||||
mysterious_id: ""
|
mysterious_id: ""
|
||||||
|
user_id: ""
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "List Subscriptions"
|
- name: "List Subscriptions"
|
||||||
|
|
@ -24,19 +25,3 @@
|
||||||
- name: "Print Result: List of Subscriptions"
|
- name: "Print Result: List of Subscriptions"
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ list_subscription }}"
|
msg: "{{ list_subscription }}"
|
||||||
|
|
||||||
- name: "Detail Subscriptions"
|
|
||||||
ansible.builtin.uri:
|
|
||||||
url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrUserDetails&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}"
|
|
||||||
method: POST
|
|
||||||
body: "{{ lookup('ansible.builtin.template','detail_subscriptions.json.j2') }}"
|
|
||||||
headers:
|
|
||||||
Accept-Encoding: gzip, deflate, br, zstd
|
|
||||||
Content-Type: application/json
|
|
||||||
Origin: https://www.zuginfo.nrw/
|
|
||||||
Referer: https://www.zuginfo.nrw/
|
|
||||||
register: detail_subscription
|
|
||||||
|
|
||||||
- name: "Print Result: Details of Subscriptions"
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ detail_subscription }}"
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue