sindresorhus / Actions

⚙️ Supercharge your shortcuts
https://sindresorhus.com/actions
2.62k stars 113 forks source link

Action proposal: Get Contents (of Web Page) With Headers #44

Open hacdias opened 2 years ago

hacdias commented 2 years ago

Description

Right now, the provided "Get contents of" action in Shortcuts doesn't follow redirects or even allow to access the response headers. Right now, you can only get headers from a HEAD request and not from a regular GET/POST request.

I have a very specific use-case where I need to know where the page is redirecting to (or really just follow the redirect), but being able to use the response HEADERs would be more useful in general.

sindresorhus commented 2 years ago

It sounds like a bug that the built-in action does not follow redirects. You should definitely send feedback to Apple about that.

sindresorhus commented 2 years ago

As for the proposed action. It sounds ok. I think the action should follow redirects by default, but have an option to opt out of it.

It will be some months before I can get to this though. Apple is changing the way to make shortcut actions in iOS 16, and I don't want to make more actions using the old way.

eiko4 commented 11 months ago

@sindresorhus not only does it not follow the redirect but it also has no timeout. Because of this, many shortcuts do not work normally, for example https://github.com/Yue-Yang/ChatGPT-Siri

apparently chatgpt has a long timeout even in chatgpt3.5-turbo

Here's more people suffer because of this: https://www.reddit.com/r/shortcuts/comments/dgpors/how_to_deal_with_a_failed_get_request_because_api/ https://www.reddit.com/r/shortcuts/comments/qy097y/get_contents_of_url_fails_to_connect/ https://www.reddit.com/r/shortcuts/comments/11zigj9/handling_time_out_and_api_errors_using/ https://www.reddit.com/r/shortcuts/comments/q6bca9/network_timeout/

"Get Contents of Url" action does not working properly, adding this to the app will help us a lot.