Trying to extract string from curl redirected URL

Anonymouse asdf at
Sun Feb 10 15:26:53 UTC 2019

On Sunday, 10 February 2019 at 14:12:02 UTC, Josh wrote:
> Is there something I'm missing? It it possible to access the 
> private handle? Is there a better way to do what I'm trying to 
> achieve?

Assuming I'm understanding your question (you want to get the 
path of a URL after redirects), if you're not adverse to 
dependencies you could use requests;

Create a Request, query an URL for a Response and then access its 
finalURI member. Then parse the path string normally to get the 
session ID, such as with std.algorithm.findSplit and friends or 
with regex.

import requests;

Request req;
Response res = req.get("");

string id = res.finalURI.path

if (!id.length) { /* no ID in URL */ }

More information about the Digitalmars-d-learn mailing list