This project lets you fetch your Pocket Casts statistics and put them into Airtable with about 80 lines of code. 🎉
For the tool to work you'll need a free Airtable account. If you don't have one - make one.
-
Go to this example base: https://airtable.com/shryxs3YOERmBeHl1
-
Click on
Copy base
in the top right corner -
Once copied delete the records
-
Click on your profile picture in the top right corner
-
Select
Account
-
On the page click on
Generate API key
on the right side under API- Save the key and use it later for the
AIRTABLE_API_KEY
key
- Save the key and use it later for the
-
Go to this page and select your copied base: https://airtable.com/api
-
Select
AUTHENTICATION
on the left side -
On the right side there should be a dark area with text looking like this:
$ curl https://api.airtable.com/v0/appr9hgXPZbBPqV4n/PocketCasts?api_key=YOUR_API_KEY
- Save the part between the alphanumeric string for later use (here it would be
appr9hgXPZbBPqV4n
) - The saved string will be used as
AIRTABLE_BASE_ID
-
Follow the next steps
For this to work you'll need a free Gitlab.com account. If you don't have one - make one.
-
Make a new project on Gitlab.com.
-
Import this repository as the base for your project.
-
Setup all environment variables in the project.
-
Go to
Settings
>CI / CD
(on the left) -
Insert variables under
Variables
(click expand, also seeEnvironment variables
)
-
-
Setup the Pipeline Scheduler
-
Go to
CI / CD
>Schedules
(on the left) -
Click the green button on the right
New schedule
-
Give it a description (eg. "Get new stats every 2h")
-
Select
Custom ( Cron syntax )
underInterval Pattern
-
Insert the following into the field:
0 */2 * * *
(runs every 2 hours) -
Make sure under
Target Branch
you selected yourmaster
branch -
Make sure the checkbox
Active
is checked -
Click the
Save pipeline schedule
-
-
Profit! :)
POCKETCASTS_EMAIL
- the email address of your PocketCasts loginPOCKETCASTS_PASSWORT
- the password to login to PocketCastsAIRTABLE_BASE_ID
- the ID of the Airtable base which is used to store the dataAIRTABLE_API_KEY
- your account API key to access AirtableAIRTABLE_POCKETCASTS_TABLE
- the table to store the PocketCasts information in
IMPORTANT: You cannot use special characters like .!$/\|
symbols in the environment variables!
- Make a copy of the
.env_example
file and name it.env
- Put in your credentials as mentioned in Environment variables
- Test the app via docker with:
make
- Profit! :)
Please make sure you run black
on your code before you commit it!
This project uses about 80 lines of code according to cloc
:
➜ cloc app.py .gitlab-ci.yml
2 text files.
2 unique files.
0 files ignored.
github.com/AlDanial/cloc v 1.80 T=0.01 s (157.1 files/s, 12570.7 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Python 1 28 43 70
YAML 1 4 0 15
-------------------------------------------------------------------------------
SUM: 2 32 43 85
-------------------------------------------------------------------------------
- Pocket Casts for being an awesome podcast player!
- airtable-python-wrapper as an awesome library to connect to Airtable
- furgoose/Pocket-Casts as a good reference how to query the PocketCasts "API"
- Airtable for being just an awesome tool!
- Gitlab and
GitlabCI
for being an all in one solution - Gitlab Scheduler for Pipelines because without it you would need a server.
- gitmoji for better understandable commits through emojis. 🎉
- pylama for checking the code quality.
- pytest for being an awesome testing framework.
- pytest-cov for generating coverage reports.
- black as an awesome code formatter for Python.
- Travis CI for being a nice tool for CIs on Github. 👷
- codecov for showing the code coverage and help improve it.
- pyup for helping to keep this project secure.
- codacy for helping improving the code quality.
[ ~ Dependencies scanned by PyUp.io ~ ]