Sign inSign up

openpodcast/apple-automation

By openpodcast

•Updated 3 months ago

Image
0

4.3K

openpodcast/apple-automation repository overview

⁠Apple Automation

This is a simple automation to receive your credentials for the Apple Podcasts Connect website. It requires an SMS service to receive the 2-factor authentication code.

The output is a JSON file with your session cookie. This is used by our Apple connector⁠ to retrieve your metrics.

⁠Setup

Create a .env file in the root of the project. Check the .env.sample file for the required environment variables.

Run npm install to install the dependencies.

⁠Usage

Source the .env file and run the service to start the automation.

HEADLESS=false make dev

This will start the service on port 3000 and open a browser window on request.

Set API_TOKEN to the bearer token, or set API_TOKEN_FILE to the path of a file containing the bearer token. If both are set, API_TOKEN takes precedence. After that you can retrieve your credentials by requesting the /cookies endpoint:

curl -H "Authorization: Bearer $API_TOKEN" \
     -H 'Content-Type: application/json' \
     'localhost:3000/cookies?podcastId=1234567'

If you use API_TOKEN_FILE, read the token from the file when making requests:

curl -H "Authorization: Bearer $(cat "$API_TOKEN_FILE")" \
     -H 'Content-Type: application/json' \
     'localhost:3000/cookies?podcastId=1234567'

The podcast ID to Apple account map is cached on disk so it survives restarts. Set ACCOUNT_MAP_CACHE_FILE to override the cache path; it defaults to ./account-map-cache.json.

If a requested podcast ID is not found in the cached map, the service refreshes this map automatically and updates the cache. To force-refresh the map manually, call:

curl -X POST -H "Authorization: Bearer $API_TOKEN" \
     'localhost:3000/debug/account-map/refresh'

The service also exposes an unauthenticated health endpoint:

curl 'localhost:3000/health'

Once you receive the verification code via SMS, you can send it to the /code endpoint.

The code typically looks like this: #123456 (6 digits). (Note that the # character needs to be URL encoded as %23.)

We provide an easy way to do this via make:

make code-123456

This will send a curl request to the /code endpoint.

Tag summary

Content type

Image

Digest

sha256:0e7e13c07…

Size

890.7 MB

Last updated

3 months ago

docker pull openpodcast/apple-automation:sha-c9dcaea