How do I get the final URL from a redirect link? (like requests.get from python)?
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm using a SERP API to return Google Shopping links, and sometimes it returns Google aclk redirect links. In Python, the requests.get command and accessing the .url field gives me what I'm looking for. I tried using python within Matlab and it works with a single url, but when I try to use within a for loop it always freezes.
2 Kommentare
Hank Helmers
am 6 Apr. 2022
What is the Request.get method equivalent in matlab that you got to work?
Antworten (1)
Mohammad Sami
am 7 Apr. 2022
You can use the matlab.net.http interface to follow the redirects.
request = matlab.net.http.RequestMessage;
uri = matlab.net.URI('https://goo.gl/maps/co8U2mMv8zFweDzN8');
[response,completedrequest,history] = send(request,uri);
finaluri = history(end).URI;
disp(finaluri);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!