chubin / wttr.in

:partly_sunny: The right way to check the weather
https://wttr.in
Apache License 2.0
24.66k stars 1.11k forks source link

explicit request for HTML #703

Open JacksonChen666 opened 2 years ago

JacksonChen666 commented 2 years ago

currently, wttr.in uses user agent strings to determine the best response to return to the client.

by default, curl gets ANSI in response. but let's say, someone is trying to render the HTML instead of PNG because it's so low res.

the only option here is to change the user agent to something else that does not contain the keyword curl anywhere in the string of the user agent (not even spaces around curl work)

proposals (sorted from most preferred to least preferred of personal choice and misc.):

all which ignore the user agent and returns HTML anyways.

hello-smile6 commented 2 years ago

currently, wttr.in uses user agent strings to determine the best response to return to the client.

by default, curl gets ANSI in response. but let's say, someone is trying to render the HTML instead of PNG because it's so low res.

the only option here is to change the user agent to something else that does not contain the keyword curl anywhere in the string of the user agent (not even spaces around curl work)

proposals (sorted from most preferred to least preferred of personal choice and misc.):

  • a long argument (similar to lang arg) output_format or format which can = to PNG, HTML, ANSI, plain, JSON, etc.
  • H argument for getting HTML (similar to using M for getting meter/s wind speeds)
  • _arguments.html (similar to png format request)

all which ignore the user agent and returns HTML anyways.

https://wttr.in/:help

JacksonChen666 commented 2 years ago

currently, wttr.in uses user agent strings to determine the best response to return to the client. by default, curl gets ANSI in response. but let's say, someone is trying to render the HTML instead of PNG because it's so low res. the only option here is to change the user agent to something else that does not contain the keyword curl anywhere in the string of the user agent (not even spaces around curl work) proposals (sorted from most preferred to least preferred of personal choice and misc.):

  • a long argument (similar to lang arg) output_format or format which can = to PNG, HTML, ANSI, plain, JSON, etc.
  • H argument for getting HTML (similar to using M for getting meter/s wind speeds)
  • _arguments.html (similar to png format request)

all which ignore the user agent and returns HTML anyways.

https://wttr.in/:help

yes, what about that?

Screen Shot 2022-02-20 at 19 50 12
hello-smile6 commented 2 years ago

Then why not add a mode? Or use https://github.com/chubin/wttr.in/blob/5782f4f53e1c22bf7b7d6eb7a83e37f976ae62a7/share/ansi2html.sh client-side?

hello-smile6 commented 2 years ago

Also, https://github.com/chubin/wttr.in/blob/5782f4f53e1c22bf7b7d6eb7a83e37f976ae62a7/share/help.txt

chubin commented 2 years ago

It is a good feature. Accepted :+1: