Download Overcast OPML Help requested

I’m hoping someone can help me learn how to get a file from website with authentication using Scriptable. Use case is downloading podcast feed/listening history from overcast.fm to later parse for journaling or figuring out listening history/patterns. I am inexperienced in trying to sort out API calls to make this work.

// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: orange; icon-glyph: cloud-download-alt;


let r = new Request('https://overcast.fm/account/export_opml/extended');

r.method = 'POST';
r.addParameterToMultipart("email","email@domain.com");
r.addParameterToMultipart("password","password");

let payload = await r.loadString();

let fm = FileManager.iCloud();
let docpath = fm.documentsDirectory();


let filepath = fm.joinPath(docpath,"overcast.opml");
fm.writeString(filepath, payload);

If Method = “POST” it just downloads the html/css of the webpage, not the file itself. If Method = “GET” it throws a resource exceed maximum resource which best I can tell with googling/stack overflow may be an iOS issue but I suspect its probably more an issue of me configuring the request incorrectly.

BG

1 Like

Hey @bcg4duke, Overcast doesn’t really offer an API. I tried the calls you’ve done in Postman and both came back with just the HTML pages you were talking about and not the file you’re looking for. This is true for either GET or POST. I’m going to look through the HTML/JS returned to see if there’s anything interesting.

You have to POST through the login page first before the GET of the file. Here’s an example.

r.method = "POST"
r.addParameterToMultipart("email", "login@mail.com")
r.addParameterToMultipart("password", "password")
log(await r.loadString())

r = new Request('https://overcast.fm/account/export_opml/extended')
r.method = "GET"
let resp = await r.loadString()
log(resp) 
1 Like

I do this in Python rather than a Shortcut, and yes, you have to do it through the login page. Which means you have to ensure that you are logged out before you run the script, otherwise it will fail.

response = session.post('https://overcast.fm/login', data={
    'email': "Your@email",
    'password': "YourPassword"
})

Jeremy

Thank you both for your feedback. I was able to get working with the first solution in Scriptable first using a POST to the login url with credential of email/password as added parameters and then to just do a GET call to the file URL without parameters and then return that as a string.


let login = new Request('https://overcast.fm/login');
login.method = 'POST';
login.addParameterToMultipart("email","email@domain.com");
login.addParameterToMultipart("password","redacted");

log(await login.loadString())

let r = new Request('https://overcast.fm/account/export_opml/extended');

r.method = 'GET';

let payload = await r.loadString();

log(payload);

// parse payload in further parts of the script