With an error of 404, HTML does not return
With an error of 404, HTML does not return. xidel only gives an error and does not extract data
xidel -se "//title" "https://player.vimeo.com/video/150619949?title=0&byline=0&portrait=0"
Error:
Internet/HTTP Error: 404
when talking to: https://player.vimeo.com/video/150619949?title=0&byline=0&portrait=0
There are no problems through pipe with curl:
curl -skL "https://player.vimeo.com/video/150619949?title=0&byline=0&portrait=0"|xidel -se "//title"
Sorry
This is a request with xidel and google chrome 90 user-agent:
$ xidel --help
[...]
--error-handling=<string> How to handle http errors, e.g.
1xx=retry,200=accept,3xx=redirect,4xx=abort,5xx=skip
$ xidel -s --error-handling='xxx=accept' "https://player.vimeo.com/video/150619949?title=0&byline=0&portrait=0" -e '//title'
Sorry
@Reino17,
Everything works on the 20250222.git3e7e88a6230719de8bb1c6d5cedaf615f5a86bdb version. On the last androidarm64 versions (20230616.8842.e14a96920e01) does not work. But the 'handle' switch is available there
OK. But what if the response errors 404 is unknown?
xidel -s --error-handling='xxx=accept' "https://google.com" -e '//title'
301 Moved
Normally you shouldn't worry about it, because --error-handling='200=accept' is the default and Xidel automatically redirects:
$ xidel -s --error-handling='200=accept' "https://google.com" -e '$url,$headers[1]'
$ xidel -s "https://google.com" -e '$url,$headers[1]'
https://www.google.com/
HTTP/1.1 200 OK
With --error-handling='301=accept', or as shown above with --error-handling='xxx=accept' to catch all, you can override this behaviour:
$ xidel -s --error-handling='301=accept' "https://google.com" -e '$url,$headers[position() le 2]'
https://google.com/
HTTP/1.1 301 Moved Permanently
Location: https://www.google.com/
I can't help you with Android binaries of Xidel. I've seen the discussion....
I barely remember how they are made
Too bad :( I use xidel on my smartphones as well
...and I hope for you Benito can remember how he made them.
@Reino17,
Normally you shouldn't worry about it, because --error-handling='200=accept' is the default and Xidel automatically redirects:
I meant something else. The 404 response is not known (maybe yes, but maybe not). If you use --error-handling='xxx=accept' for the response 404 where it is not (google.com) you will return the response "302 moved", not html. Such a solution to the html return with an error of 404 is not universal. Only where 404 are known for sure
--error-handling='404=accept'?
or --error-handling='4xx=accept'
@Reino17, @benibela
error-handling key will not return html where there is no 404 error by default (google.com) and I will not get html and will not be able to extract data
Where there is a 404 error (but I don't know this), you need to use error-handling to extract html, otherwise there will be an error :\
Error:
Internet/HTTP Error: 404
when talking to: https://player.vimeo.com/video/150619949?title=0&byline=0&portrait=0
How can I get html for google and vimeo? How can I extract title in all cases? In one way?
xidel.exe -s --error-handling="4xx=accept" "https://player.vimeo.com/video/150619949?title=0&byline=0&portrait=0" -e "//title"
This, as suggested 3 weeks ago, doesn't work?