Skip to main content

Anchor Connector for Podcast Data

Project description

Anchor Connector

Docs

OpenPodcast Banner

This is a simple library for connecting to the unofficial Anchor API.
It can be used to export data from your dashboard at https://anchor.fm/dashboard.

Supported Endpoints

  • total_plays
  • plays_by_age_range
  • plays_by_app
  • plays_by_device
  • plays_by_episode
  • plays_by_gender
  • plays_by_geo
  • plays_by_geo_city
  • episodes

For each episode, the following endpoints are supported:

  • episode_plays
  • episode_performance
  • episode_aggregated_performance
  • episode_all_time_video_data

See __main.py__ for all endpoints.

Credentials

Before you can use the library, you must extract your Anchor credentials from the dashboard; they are not exposed through your Anchor settings.

You can use our web-extension for that or take a look at the code to see how to do it manually.

Installation

pip install anchorconnector

Usage as a library

from anchorconnector import AnchorConnector

connector = AnchorConnector(
   base_url=BASE_URL,
   webstation_id=WEBSTATION_ID,
   anchorpw_s=ANCHOR_PW_S,
)

end = datetime.now()
start = end - timedelta(days=30)

total_plays = connector.total_plays(True)
logger.info("Podcast Total Plays = {}", json.dumps(total_plays, indent=4))

plays_by_age_range = connector.plays_by_age_range(start, end)
logger.info(
   "Plays by Age Range = {}",
   json.dumps(plays_by_age_range, indent=4),
)

# plays_by_app = connector.plays_by_app(start, end)
# plays_by_device = connector.plays_by_device(start, end)
# plays_by_episode = connector.plays_by_episode(start, end)
# plays_by_gender = connector.plays_by_gender(start, end)
# plays_by_geo = connector.plays_by_geo()
# plays_by_geo_city = connector.plays_by_geo_city("Germany")
# ...


for episode in connector.episodes():
   logger.info("Episode = {}", json.dumps(episode, indent=4))

   web_episode_id = episode["webEpisodeId"]

   episode_meta = connector.episode_plays(web_episode_id)
   logger.info("Episode Metadata = {}", json.dumps(episode_meta, indent=4))

   # ...

See __main.py__ for all endpoints.

Development

We use Pipenv for virtualenv and dev dependency management. With Pipenv installed:

  1. Install your locally checked out code in development mode, including its dependencies, and all dev dependencies into a virtual environment:
pipenv sync --dev
  1. Create an environment file and fill in the required values:
cp .env.sample .env
  1. Run the script in the virtual environment, which will automatically load your .env:
pipenv run anchorconnector

To add a new dependency for use during the development of this library:

pipenv install --dev $package

To add a new dependency necessary for the correct operation of this library, add the package to the install_requires section of ./setup.py, then:

pipenv install

To publish the package:

python setup.py sdist bdist_wheel
twine upload dist/*

or

make publish

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anchorconnector-0.5.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anchorconnector-0.5.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file anchorconnector-0.5.0.tar.gz.

File metadata

  • Download URL: anchorconnector-0.5.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.19

File hashes

Hashes for anchorconnector-0.5.0.tar.gz
Algorithm Hash digest
SHA256 62d953cfcc80fa2b17978ee9c8fbb6397366f6fe2a273de393aaa27e498c58ce
MD5 90f00f863b888dc4b078e0da245a9545
BLAKE2b-256 11b08a23e1058fb4c210d65951ae9c95f6cd3f4ca177c3310b6a5bddaff7d1a6

See more details on using hashes here.

File details

Details for the file anchorconnector-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for anchorconnector-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 295d81747e1c07a946ac8560d0a4815f2f93f30764bb8ad234582f5a5f553f1a
MD5 5109a3a4c5647c181e28104de1847098
BLAKE2b-256 1148e0aad47c3fb18c7ad376e663033520c145aa215bdcd203961f60b8e00e5c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page