Experiment Three: Bus, Bus

The third installment in the series.

Today’s trip to and from Stars for Life was on the bus in both directions: I caught the 3:45 p.m. Route № 2 bus in front of the Polyclinic and rode out to the corner of Maypoint Road and Beach Grove Road, picked up Oliver, and then we rode back downtown on the 4:28 pm. Route № 3 bus.

Statistics

  • Bus Fares: $6.00
  • Bus Distance: 11 km
  • Total Time: 60 minutes

Pros

  • Convenient bus connection, almost door-to-door in both directions.
  • Bus shelter on Beach Grove Road, in the shade, made for a pleasant place to wait.

Cons

  • Watching almost every single vehicle turning right from Beach Grove Road onto Maypoint Road roll right through the stop sign without even touching the brakes was disquieting.
  • A 4:15 p.m. bus back on Route № 3 would have shaved 15 minutes off the trip and made it essentially identical, time-wise, to taking the car.
  • The bus back was crowded, so the only place for us to sit, with Ethan the Dog, was in the three seats at the front, meaning that the only place for Ethan was in the aisle, blocking everyone who got off and on the bus during the trip (we were able to move back to more self-contained rear seats about halfway through the trip as the crowd thinned out).

Short of a more robust cycling solution that might present itself in the future, this experiment is the clear winner so far.

Because we beta-tested this routing last month with Olle, we call this “The Olle Routing.”

Pocket Casts Import and Export

Given what I wrote about Spotify being a prison for podcasts, it might be helpful to point out that Pocket Casts (acquired last year by NPR et al), my podcast player of choice, supports export and import of podcast subscriptions using the open OPML format.

This isn’t supported by their web player, but both their iOS and Android apps support both exporting your list of podcasts for use elsewhere, and importing a subscription list from elsewhere:

Oliver’s slowly migrating his podcasts, curating as he’s going along to reduce the number, from Spotify to Pocket Casts; it’s nice to know that he’ll be able to get his subscriptions out if he ever wants to.

Here’s my OPML for the podcasts that I subscribe to.

Just remember to put your phone down sometimes”

About a decade ago, I went out to lunch with several friends in Berlin at La Bonne Franquette, a French restaurant near the Nokia office where they all worked.

Beyond the good company and the good food, the meal was remarkable in that it was the first time I witnessed a group of familiars simultaneously remove their mobile phones from their pockets, check in on Foursquare, and then leave their phones on the table beside them.

In that simple action, mobile phones went from being private objects to being public objects, and everything that’s happened since that point has only moved us farther down that road. To the point where, sitting in Kettle Black Marché the other day, I was witness to someone watching a YouTube video on their mobile, without earphones, as though it was a completely normal thing.

In light of this trajectory toward the complete breakdown of the social contract, I was heartened to come across some buffeting winds in the past week.

First, a colleague who’s just started a a new position messaged me about his new working conditions:

They have a strict “no mobile devices” in the main house, if you are in a conversation with a group.

I would vote for that as a universal rule, if given the opportunity.

On the same day, CBC’s Q aired an interview with the musician Sara Bareilles where

Tom Power: Why did you take it upon yourself to write the jingle for turning off your cell phone at your musical?

Sara Bareilles: Phones are such a problem in the theatre at this point… oh my gosh, it’s extraordinarily bad. People videoing… just forgetting that they’re not engaging in an experience that’s a normal… I mean concert goers alone are so glued to their phones… that’s something I’ve noticed over the years, is that more and more people are watching us through the screens on their phones, standing in front of you, but they’re paying attention to what they’re getting on a video, which is a strange kind of phenomenon to have evolved. But the theatre, for all intents and purposes, is still a sacred space that way. So we thought maybe we could do it in a kind of cheeky, funny way, to remind people that phones are not allowed.

TP: That’s kinda nice.

SB: It doesn’t work. People still bring out their phones all the time. It’s annoying.

TP: I went to a Jack White concert not that long ago, and he does that thing where you gotta put your phone in a pouch. You put your phone in a pouch and it locks. You get to take it with you, and then you get to unlock it on the way out. And that’s when you get your phone back. Dave Chappelle does it too. What’s cool about it is that, I was kind of “Give me a break, I’m an adult…” But when I went to the show, it was like 17,000 people, and every single person was looking at the stage. Now I know that sounds–if you’re listening to this at home–”of course they are Tom, it was a concert.”

SB: No, but they’re not. They’re usually not.

TP: It was amazing.

SB: Yeah. I’ll tell you what I noticed: I just did a little promo tour, I have a new record that just came out and I’ll be going on tour in the fall, but I did a little four-show promo tour, and because people weren’t familiar with the material yet, nobody took their phones out. Which I thought was amazing. I haven’t looked out at an audience in a long time and not have them be holding up their phones. So I thought that was really interesting. Just remember to put your phone down sometimes.

A couple of days later, reading Inside the Cultish Dreamworld of Augusta National in The New Yorker, I learned that phones are not allowed at the Masters Tournament:

Each member of the media has a work station with a brass nameplate, a leather swivel chair, a pair of computer monitors, and a surfeit of real-time tournament footage and information—far more data than one would be able to gather out on the golf course, especially because, outside the press building, reporters are not allowed to carry cell phones. (The phone ban, strictly enforced and punishable by immediate removal from the grounds, applies to patrons and members, too. One morning during the tournament this year, a story went around that the club had done a spot inspection of staff headquarters and found that an employee had hidden a cell phone between two slices of bread.) The golfers and the tournament officials appear dutifully for press conferences; why bother heading out to the clubhouse to hound them for quotes? No phones are allowed at the press conferences, either. The club wants control over sounds and pictures—the content.

These are all hopeful signs that the tide might be turning in the other direction.

One of the unanticipated consequences of arranging our chairs in a circle at the Crafting {:} a Life unconference last month is that the architecture of the arrangement made using mobile phones socially unacceptable: we didn’t need to even bring it up, as it would have been simply too noticeable (and shameful) to disengage so obviously. Of course we also tried to create an engaging situation–”new material,” in the Bareilles construction–where the opportunity to interact with present humans was more alluring that whatever the digital universe might offer.

I have a good friend who, when we first got to know each other was, if not a Luddite, at least disinclined to bring technology out into public. Since that time, though, he’s moved up the career ladder to the point where it’s a job requirement that he not only carry a phone, but that he respond to text messages and emails immediately (if only because, if he doesn’t, the backlog will become untenable). As a result of this transformation, going to lunch with him has become a period punctuated by long and uncomfortable silences while he does business at the table.

Would it be too much to bring a locking pouch to our next meal out?

The Altruistic Smart Grid. Or “how to charge your mobile phone only when we’re generating green electricity”

At the last meeting of the PEI Electric Vehicle Association there was talk of how, at some point in the future, we’ll have a “smart grid” on Prince Edward Island, with electricity rates adjusted to match supply and demand, so that, for example, our electric vehicles can charge themselves when demand is low and we’re generating “green” electricity.

There are innumerable things that have to happen before our electricity grid can support this, both regulatory and technical. The electricity meters in our houses, for example, are “dumb” meters and would have to be replaced with “smart” ones that could communicate in real time with the utility.

A lot of the talk about smart grids is based on the assumption that we need price signals to modify our behaviour; while that may be true, it ignores the fact that some people will seek greener opportunities simply from altruism.

And, it turns out, we have all the tools we need right now to build an “altruistic smart grid” ourselves.

Here’s what it might look like.

Screen shot of my Node-RED flow to turn on and off an electrical outlet based on percentage wind energy generation.

This is a computer program (technically a “Node-RED flow”), running on a tiny, inexpensive Raspberry Pi computer, that turns a Wemo power outlet on or off, depending on whether we’re generating “green” electricity on Prince Edward Island. I built it so that I could charge my mobile phone only when we’re generating green electricity.

It works by doing the following every 15 minutes:

First, it looks to see if the electrical outlet is on or off, and remembers this for later.

Next, it looks up the current state of PEI’s electricity load and generation from a system I created that returns a chunk of data that looks like this:

{
  "on-island-load": "181.66",
  "on-island-wind": "4.83",
  "on-island-fossil": "0.00",
  "wind-local": "4.83",
  "wind-export": "0.00",
  "percentage-wind": "2.66",
  "updatetime": 1562592600,
  "updatetime_human": "2019-07-08 10:30:00"
}

The “percentage-wind” figure is the percentage of PEI’s current electricity load–”how much electricity we’re all using right now”–that’s being generated from wind power.

I arbitrarily decided to call “more than 50%” green electricity.

If we’re generating more than 50% of our electricity from the wind, and the electrical outlet is off, then it gets turned on.

If we’re generating less than 50% of our electricity from the wind, and the electrical outlet is on, then it gets turned off.

The parts to assemble this–a Raspberry Pi, a Wemo outlet–cost less than $100.

Because the “smart” in this DIY altruistic smart grid are programmable, this is only the simplest version of how such a system might work: I could, for example, enhance the system to look at the current state of my phone’s battery and to override the green energy requirement if it dips too low. Or turn off the switch when the phone’s battery is fully charged.

Here’s the complete flow, ready for import into Node-RED, should you wish to try this at home.

Midwifery Shouldn’t Be “User Pay”

During Question Period in the PEI Legislative Assembly on Friday came this exchange between the Leader of the Opposition, Peter Bevan-Baker, and the Minister of Health and Wellness, Hon. James Aylward:

Leader of the Opposition: Although the official opposition has stated vigorously and repeatedly that we are disappointed in the amount of money pledged in the budget to the priorities that we have brought to government, one item I personally was glad to see receive some funding was for midwifery. Many people have been advocating for the establishment of midwifery services on PEI for decades, and I believe that this is actually the first time that dedicated funding has found its way into a budget. For that, I am indeed grateful. According to the budget, this year’s allocation of $150,000 is and I quote: “to allow these services to be appropriately established consistent with current and anticipated demand.” A question to the Minister of Health and Wellness: Could you tell the House exactly what that statement means?

Mr. Aylward: Thank you very much, Mr. Speaker. As I’ve spoken several times during this session with regards to midwifery services and in the past when I was in opposition, I’m certainly looking forward to having this service provided here on Prince Edward Island. There is a process that needs to be followed. We need to ensure that when midwifery is fully operational and introduced here on Prince Edward Island that it’s just not done haphazardly. There’s consultation to be taken with, obviously, the college of physicians, the PEI Medical Society, we have to determine how it’s going to be introduced, if there’s going to be employees of Health PEI, if it’s going to be user pay. So there’s many issues around the introduction of midwifery here on Prince Edward Island. But as the Minister of Health and Wellness, I’m extremely proud that I’m going to be the minister that will finally be able to make this happen here on Prince Edward Island.

A satisfying answer. Until you get to the “if it’s going to be user pay” tucked in at the end.

The Leader of the Opposition noticed this too, and returned to address it at the end of several more questions about the details of the plans for the introduction of midwifery:

Leader of the Opposition: One of the statements made, again, in the answer I loved so much, I’m starting to love it a little bit less now – was you mentioned user-pay, could you elaborate a little bit on what you might mean by that? A user-pay for midwifery services seems like an odd statement for a health minister to say.

Mr. Aylward: Thank you very much, Mr. Speaker. Once again, as I said, we have to still go through this whole consultation process with our current health care providers. Currently on Prince Edward Island there is approximately 1,400 births annually here on Prince Edward Island and currently, as well, our compliment of health care professionals, OBGYN’s etc cetera, are more than capable of handling that number of births. Yes there is a request to have midwifery here on PEI, I’m extremely supportive of this service, I always have been and I will continue to be. But until we have all the details around how midwifery will be introduced, integrated in our health care system, it’s impossible for me to answer specifically, precisely today on how that will be rolled out. It’s a process and we’re working through that.

Leader of the Opposition: Thank you. Can I just get a confirmation though from the minister that when he used the word user-pay he’s not suggesting that for Island women to access midwifery services that they will themselves have to actually pay for that?

Mr. Aylward: Thank you very much, Mr. Speaker. Again, as I’ve said, we are working through a process currently right now and until we have all the details and we’ve had all the consultation with all the health care providers here on Prince Edward Island in, addition to the midwifery association, I can’t specifically answer that question. Thank you very much, Mr. Speaker.

Leader of the Opposition: Wow.

Wow indeed.

Later in the day the CBC reported about the exchange, under the headline P.E.I. targets early 2020 for midwifery, but Islanders may have to pay out of pocket, in part:

Among the considerations, Aylward said, is whether the services would be “user-pay” — something Bevan-Baker said he was “a little horrified” to hear.

We have a public health service and midwifery is absolutely, in all other jurisdictions, a part of the public health service,” Bevan-Baker said.

So even the suggestion that this would become a user-pay system where … families out-of-pocket, would have to pay for this, is quite an extraordinary thing.”

I share Bevan-Baker’s shock at the suggestion that midwifery would be even considered as a “user pay” service, both for the fact itself, and for what this suggests about how midwifery is conceived of by the government.

Midwifery is not an upgrade to business class, it’s basic health care.

There is no rationale whatsoever for classifying it as anything other than this, and to fly a trial balloon that positions it otherwise is an insult to those who have worked so tirelessly for so long to reintroduce a practice that was standard and accepted during our grandparents’ day.

I trust that the opposition will continue to make this point clear to government.

Spotify is a Prison for Podcasts

I have been a happy customer of Spotify for several years now, after flirting back and forth with Apple Music, Google Play Music and the late Rdio for several years before that. We have a family subscription, which we all three use extensively, no more so than Oliver who, for many months now has been making nightly playlists to go to sleep listening to.

Spotify has recently been promoting itself as much a podcast player as a streaming music service, and Oliver has followed the lead and has accumulated a subscription list of 1500+ podcasts in Spotify.

Last night, though, he was thinking about migrating to something else for his podcast listening: he didn’t like the fact that, although the Android Spotify app sports an “episodes” tab, the desktop player for the Mac does not, which makes tracking recently-released episodes on his Mac more challenging.

Having found a possible alternative, Oliver set out to move his list of podcasts from Spotify to a new app, and was immediately faced with a task that would have extended for several days: for each of the podcasts in Spotify he was taking the title, copying and pasting it into the new app, and subscribing there. Over and over and over. When this job threatened to take over his Friday, to the exclusion of other activities, I interceded and told him that we should simply export his list of podcasts from Spotify and import it into the new app.

How naive I was.

Spotify, it turns out, is a prison for podcasts.

Spotify takes podcasting, a system that is a marvel of decentralized openness, built on the strong and flexible (and open) foundation of RSS, and locks it inside a closed, proprietary system with no way of getting data in or out. You can’t import lists of podcasts. You can’t export lists of podcasts. You can’t add your own podcasts.

Surely, I thought, given the GDPR, there must be a way of getting Oliver’s personal information–including his podcasts–out of Spotify.

And there is, in theory: if you visit your Account page in Spotify, and then navigate to Privacy, and scroll down to the bottom, you will see a section called Download your data, full of promise.

Until you read the fine print and learn that “This can take up to 30 days to complete”:

Screen shot of the Download your data section of Spotify's Privacy page

How it’s possible to create a system that takes 30 days to assemble digital data boggles the mind, and while it may live up to the letter of the GDPR, it surely defies the spirit.

What about using the Spotify API?

Although it’s not documented, there is and endpoint that exposes the list of podcasts for a user.

Here’s how you can get at it (with the caveat, detailed below, that you are wasting your time).

Go to the Web API Console for the “Get User’s Profile” endpoint and click Get Token and then copy the cURL command on the right side (I’ve redacted Oliver’s token):

Screen shot of generating a Spotify token.

If you simply paste this cURL into the Mac command line, you’ll get back your basic account information:

{
  "birthdate" : "XXXX-XX-XX",
  "country" : "CA",
  "display_name" : "Oliver Rukavina",
  "email" : "o@ruk.ca",
  "explicit_content" : {
    "filter_enabled" : false,
    "filter_locked" : false
  },
  "external_urls" : {
    "spotify" : "https://open.spotify.com/user/12154891049"
  },
  "followers" : {
    "href" : null,
    "total" : 13
  },
  "href" : "https://api.spotify.com/v1/users/12154891049",
  "id" : "12154891049",
  "images" : [ {
    "height" : null,
    "url" : "https://profile-images.scdn.co/images/userprofile/default/6a5a73861526ed7cece0ea757ab1f043277d7ebb",
    "width" : null
  } ],
  "product" : "premium",
  "type" : "user",
  "uri" : "spotify:user:12154891049"
}

If you edit this command, however, and tack shows onto the end of the URL, replacing https://api.spotify.com/v1/me with https://api.spotify.com/v1/me/shows, you’ll get back a JSON representation of your first 20 podcast subscriptions, with each one represented by an object like this:

{
    "added_at" : "2019-03-27T02:16:27Z",
    "show" : {
      "available_markets" : [ "AD", "AE", "AR", "AT", "AU", "BE", "BG", "BH", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "DZ", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "ID", "IE", "IL", "IN", "IS", "IT", "JO", "JP", "KW", "LB", "LI", "LT", "LU", "LV", "MA", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "OM", "PA", "PE", "PH", "PL", "PS", "PT", "PY", "QA", "RO", "SE", "SG", "SK", "SV", "TH", "TN", "TR", "TW", "US", "UY", "VN", "ZA" ],
      "copyrights" : [ ],
      "description" : "It's the Peter and Oliver podcast all grown up. ",
      "explicit" : false,
      "external_urls" : {
        "spotify" : "https://open.spotify.com/show/6bDdMX7OmjDG1u5ebEhNRX"
      },
      "href" : "https://api.spotify.com/v1/shows/6bDdMX7OmjDG1u5ebEhNRX",
      "id" : "6bDdMX7OmjDG1u5ebEhNRX",
      "images" : [ {
        "height" : 640,
        "url" : "https://i.scdn.co/image/8beec05386bfef3e095bcdf46aafaee112d55fdb",
        "width" : 640
      }, {
        "height" : 300,
        "url" : "https://i.scdn.co/image/4f70272b77c24c619a79486d6c88445b976151f7",
        "width" : 300
      }, {
        "height" : 64,
        "url" : "https://i.scdn.co/image/807d9151f7fa4a0ccd96c80d0c9bc265152b6012",
        "width" : 64
      } ],
      "languages" : [ "en-US" ],
      "media_type" : "audio",
      "name" : "Oliver And Peter Podcast",
      "publisher" : "Oliver Rukavina",
      "type" : "show",
      "uri" : "spotify:show:6bDdMX7OmjDG1u5ebEhNRX"
    }
}

You may be thinking “wow, this is amazing!” until you notice that nowhere in that JSON is any information that falls outside the Spotify universe: none of the standard trappings of open podcast data–the feed URL, the website, the non-Spotify-hosted artwork–are there.

And these details also aren’t there if you follow the URL in the “href” to get all the show details:

{
  "available_markets" : [ "AD", "AE", "AR", "AT", "AU", "BE", "BG", "BH", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "DZ", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "ID", "IE", "IL", "IN", "IS", "IT", "JO", "JP", "KW", "LB", "LI", "LT", "LU", "LV", "MA", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "OM", "PA", "PE", "PH", "PL", "PS", "PT", "PY", "QA", "RO", "SE", "SG", "SK", "SV", "TH", "TN", "TR", "TW", "US", "UY", "VN", "ZA" ],
  "copyrights" : [ ],
  "description" : "It's the Peter and Oliver podcast all grown up. ",
  "episodes" : {
    "href" : "https://api.spotify.com/v1/shows/6bDdMX7OmjDG1u5ebEhNRX/episodes?offset=0&limit=50",
    "items" : [ {
      "audio_preview_url" : "https://p.scdn.co/mp3-preview/1c405e3e511e5e7199a45b1de32f83e5f88c7e24",
      "description" : "This first episode is about Vancouver BC Canada ",
      "duration_ms" : 92624,
      "explicit" : false,
      "external_urls" : {
        "spotify" : "https://open.spotify.com/episode/79W2zHGuUttBOInh642kNR"
      },
      "href" : "https://api.spotify.com/v1/episodes/79W2zHGuUttBOInh642kNR",
      "id" : "79W2zHGuUttBOInh642kNR",
      "images" : [ {
        "height" : 640,
        "url" : "https://i.scdn.co/image/53b71df32a85645777ba73afa2e9e738bd788534",
        "width" : 640
      }, {
        "height" : 300,
        "url" : "https://i.scdn.co/image/2cc3d2acae39674b3c3bfdc53ae2286a692b1376",
        "width" : 300
      }, {
        "height" : 64,
        "url" : "https://i.scdn.co/image/2f6bd66373d51f8f6f62b55997539e1554a3df4a",
        "width" : 64
      } ],
      "is_externally_hosted" : false,
      "is_playable" : true,
      "language" : "en-US",
      "name" : "Oliver and Peter Podcast episode 1",
      "release_date" : "2019-03-20",
      "release_date_precision" : "day",
      "type" : "episode",
      "uri" : "spotify:episode:79W2zHGuUttBOInh642kNR"
    }, {
      "audio_preview_url" : "https://p.scdn.co/mp3-preview/1b3548d7561908fd8b4c6625e5e4d1fdbc8198bd",
      "description" : "Episode 1 is about Vancouver BC Canada  ",
      "duration_ms" : 26958,
      "explicit" : false,
      "external_urls" : {
        "spotify" : "https://open.spotify.com/episode/5bH6wVgbHQ5aCJdthQLZrk"
      },
      "href" : "https://api.spotify.com/v1/episodes/5bH6wVgbHQ5aCJdthQLZrk",
      "id" : "5bH6wVgbHQ5aCJdthQLZrk",
      "images" : [ {
        "height" : 640,
        "url" : "https://i.scdn.co/image/53b71df32a85645777ba73afa2e9e738bd788534",
        "width" : 640
      }, {
        "height" : 300,
        "url" : "https://i.scdn.co/image/2cc3d2acae39674b3c3bfdc53ae2286a692b1376",
        "width" : 300
      }, {
        "height" : 64,
        "url" : "https://i.scdn.co/image/2f6bd66373d51f8f6f62b55997539e1554a3df4a",
        "width" : 64
      } ],
      "is_externally_hosted" : false,
      "is_playable" : true,
      "language" : "en-US",
      "name" : "Oliver and Peter Podcast episode 1",
      "release_date" : "2019-03-20",
      "release_date_precision" : "day",
      "type" : "episode",
      "uri" : "spotify:episode:5bH6wVgbHQ5aCJdthQLZrk"
    } ],
    "limit" : 50,
    "next" : null,
    "offset" : 0,
    "previous" : null,
    "total" : 2
  },
  "explicit" : false,
  "external_urls" : {
    "spotify" : "https://open.spotify.com/show/6bDdMX7OmjDG1u5ebEhNRX"
  },
  "href" : "https://api.spotify.com/v1/shows/6bDdMX7OmjDG1u5ebEhNRX",
  "id" : "6bDdMX7OmjDG1u5ebEhNRX",
  "images" : [ {
    "height" : 640,
    "url" : "https://i.scdn.co/image/8beec05386bfef3e095bcdf46aafaee112d55fdb",
    "width" : 640
  }, {
    "height" : 300,
    "url" : "https://i.scdn.co/image/4f70272b77c24c619a79486d6c88445b976151f7",
    "width" : 300
  }, {
    "height" : 64,
    "url" : "https://i.scdn.co/image/807d9151f7fa4a0ccd96c80d0c9bc265152b6012",
    "width" : 64
  } ],
  "is_externally_hosted" : false,
  "languages" : [ "en-US" ],
  "media_type" : "audio",
  "name" : "Oliver And Peter Podcast",
  "publisher" : "Oliver Rukavina",
  "type" : "show",
  "uri" : "spotify:show:6bDdMX7OmjDG1u5ebEhNRX"
}

Like I said: a prison.

And there’s another problem: this is both an undocumented API call and a broken one.

In theory you should be able to specify a “limit” and an “offset” parameter to page through podcasts and retrieve them all, like:

curl -X "GET" "https://api.spotify.com/v1/me/shows?offset=0&limit=20"
curl -X "GET" "https://api.spotify.com/v1/me/shows?offset=20&limit=20"
curl -X "GET" "https://api.spotify.com/v1/me/shows?offset=40&limit=20"
curl -X "GET" "https://api.spotify.com/v1/me/shows?offset=60&limit=20"

and so on.

But that doesn’t work.

I’m able to retrieve at most 50 podcasts (out of Oliver’s 1,986 total subscriptions). And using the Spotify web player confirms this breakage, showing a scrolling list of 50 podcasts that repeats and repeats and repeats.

Because this is an undocumented, and thus unsupported API call, it’s not like I can dial 1-800-SPOTIFY to ask for help.

But I’m not willing to give up the fight, so I forge on with this crazy, destructive nuclear option, which involves working around this bug in the undocumented API by pulling the podcasts 50 at a time, saving their name and ID, and then deleting them using another undocumented API call, so that I can then get the next 50 podcasts. And so on. Until I have them all.

(Warning: if you use this code you will be unsubscribing from all your podcasts, one by one by one).

<?php

$bearer = "INSERT THE TOKEN YOU GOT FROM THE API CONSOLE HERE";

// Open a file to write the podcast names to
$fpout = fopen("allshows.tsv", 'w');

// We're getting 1,986 podcasts, 50 at a time, and
// 1986 / 50 = 40, so we loop 40 times.
for ($show = 1 ; $show <= 40 ; $show++) {

  // Get the details of 50 podcasts from the Spotify API as JSON
  $url = 'curl -s -X "GET" "https://api.spotify.com/v1/me/shows?limit=50' .
         '" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer ' .
         $bearer .
         '"';

  $json = '';
  $fpin = popen($url, 'r');
  while(!feof($fpin)) {
    $json .= fgets($fpin, 4096);
  }
  fclose($fpin);

  // Convert the JSON into a PHP object
  $shows = json_decode($json);

  // Iterate through each of the 50 podcasts
  foreach($shows->items as $oneshow) {
    $id = $oneshow->show->id;
    $name = $oneshow->show->name;

    // Write the name and ID of the podcast into the text file opened earlier
    fwrite($fpout, $name . "\t" . $id . "\n");

    // Unsubscribe from the podcast via the Spotify API
    $url = 'curl -s -X "DELETE" "https://api.spotify.com/v1/me/shows?ids=' . $id .
           '" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer ' .
           $bearer .
           '"';

    exec($url);
  }
}
fclose($fpout);

And even this code won’t work completely, or at least it wouldn’t work in Oliver’s case: with 905 podcasts still to extract, it simply stopped returning anything from the API call to get shows, and the web player, at this point, showed Oliver with no subscriptions at all. So perhaps the API only works for the first 1,081 podcasts?

In any case, Oliver now has a text file with 1,081 podcasts in it. Or, more accurately, the names of 1,081 podcasts in it.  But how to get the feed URLs? There’s no obvious way to do this right now, although the Listen Notes API might work. Barring that, Oliver has a lot of copying and pasting ahead of him.

In summary, let this be a warning to you: if you use Spotify as your podcast app, you are a prisoner to Spotify, and if you decide to switch to another podcast app there isn’t any way to get your data out of Spotify.

Pages