diff --git a/nitter/create_guest_account.sh b/nitter/create_guest_account.sh deleted file mode 100644 index 2a767ff..0000000 --- a/nitter/create_guest_account.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -guest_token=$(curl -s -XPOST https://api.twitter.com/1.1/guest/activate.json -H 'Authorization: Bearer AAAAAAAAAAAAAAAAAAAAAFXzAwAAAAAAMHCxpeSDG1gLNLghVe8d74hl6k4%3DRUMF4xAQLsbeBhTSRrCiQpJtxoGWeyHrDb5te2jpGskWDFW82F' | jq -r '.guest_token') - -flow_token=$(curl -s -XPOST 'https://api.twitter.com/1.1/onboarding/task.json?flow_name=welcome' \ - -H 'Authorization: Bearer AAAAAAAAAAAAAAAAAAAAAFXzAwAAAAAAMHCxpeSDG1gLNLghVe8d74hl6k4%3DRUMF4xAQLsbeBhTSRrCiQpJtxoGWeyHrDb5te2jpGskWDFW82F' \ - -H 'Content-Type: application/json' \ - -H "User-Agent: TwitterAndroid/10.10.0" \ - -H "X-Guest-Token: $guest_token" \ - -d '{"flow_token":null,"input_flow_data":{"flow_context":{"start_location":{"location":"splash_screen"}}}}' | jq -r .flow_token) - -new_entry=$(curl -s -XPOST 'https://api.twitter.com/1.1/onboarding/task.json' \ - -H 'Authorization: Bearer AAAAAAAAAAAAAAAAAAAAAFXzAwAAAAAAMHCxpeSDG1gLNLghVe8d74hl6k4%3DRUMF4xAQLsbeBhTSRrCiQpJtxoGWeyHrDb5te2jpGskWDFW82F' \ - -H 'Content-Type: application/json' \ - -H "User-Agent: TwitterAndroid/10.10.0" \ - -H "X-Guest-Token: $guest_token" \ - -d "{\"flow_token\":\"$flow_token\",\"subtask_inputs\":[{\"open_link\":{\"link\":\"next_link\"},\"subtask_id\":\"NextTaskOpenLink\"}]}" | jq -c -r '.subtasks[0]|if(.open_account) then {oauth_token: .open_account.oauth_token, oauth_token_secret: .open_account.oauth_token_secret} else empty end') - -# Define the path to your JSON file -json_file="$1" - -# Add the new entry to the JSON array in the specified file -if [ -n "$new_entry" ] && [ "$new_entry" != "null" ]; then - jq --argjson new_entry "$new_entry" '. += [$new_entry]' "$json_file" > temp.json && mv temp.json "$json_file" -fi diff --git a/nitter/docker-compose.yml b/nitter/docker-compose.yml index c9370e0..8640ffd 100644 --- a/nitter/docker-compose.yml +++ b/nitter/docker-compose.yml @@ -25,17 +25,6 @@ services: interval: 30s timeout: 5s retries: 2 -# fetch new guest accounts every 12h - ofelia: - image: mcuadros/ofelia:latest@sha256:a34c6b49420f14c75f76411c653d3c7a7f144a20fb0347a2044dad8255db4676 - command: daemon --docker - volumes: - - /var/run/docker.sock:/var/run/docker.sock:ro - - /home/ubuntu/nitter/guest_accounts.json:/src/guest_accounts.json - - /home/ubuntu/nitter/create_guest_account.sh:/create_guest_account.sh:ro - labels: - ofelia.job-local.create_guest_accounts.schedule: '@every 24h' - ofelia.job-local.create_guest_accounts.command: '/bin/sh -c "apk add curl jq && sh /create_guest_account.sh /src/guest_accounts.jsonl && docker restart nitter"' redis: image: redis:7-alpine@sha256:1b503bb77079ba644371969e06e1a6a1670bb34c2251107c0fc3a21ef9fdaeca