Amazon price in Google Spreadsheets - google-sheets

I tried following the answers gave here, but I get the error Imported Xml content can not be parsed.
Here's what I tried:
=importXml("http://www.amazon.it/Asus-GeForce-Scheda-Display-Edition/dp/B00SKWIISQ/","//span[#id='priceblock_ourprice']")
=importxml(hyperlink(concatenate("http://www.amazon.it/Asus-GeForce-Scheda-Display-Edition/dp/B00SKWIISQ/")),"//*[#id='priceblock_ourprice']")
None of them worked..
EDIT: The functions are intermittently working. Seems there's an issue specifically with the Amazon site as sometimes this works, sometimes it doesn't (and I get "imported content cannot be parsed"). When it doesn't, sometimes if I add or remove the trailing slash it works again. No problem with other sites. Seems a known issue: https://productforums.google.com/forum/#!topic/docs/UuMGRl7Asew https://productforums.google.com/forum/#!topic/docs/yWPaNDK0Kpg
What's a mistery is the cause.

if you try //* xPath, then you'll see that Amazon is making a robot check. That is the reason of unsuccessful parsing.
Unfortunately, I can't see the obvious way to overcome this.
And, as to changing comma to semicolon and vice versa - it doesn't work, because it depends on your local settings for Google Spreadheet, which delimiter you have to use in functions. For some countries it's a comma, for others it's a semicolon.

Try this:
=importXml("http://www.amazon.it/Asus-GeForce-Scheda-Display-Edition/dp/B00SKWIISQ";"//span[#id='priceblock_ourprice']")
I changed the colon to semicolon and removed the trailing slash of the URL to make sure that no HTTP redirects are done.

Related

How to pass special parameters from the CLI to the browser URL bar

I have a problem passing special parameters from a bash script to a browser URL bar.
I would like to open a PDF file on a certain page, and with a certain zoom factor, and at a certain position (relative to a page corner, I think that's called "focus") in Brave, from the command line.
I thought that should work like this:
$ brave-browser file:/home/user/foo.pdf#page=5&zoom=150,50,50
(the ",50,50" would be the "focus") but it doesn't. It just provokes an error message.
Copy/pasting the entire line with all the special characters manually to the URL bar works fine, but I would like to do that without the mouse or keyboard, from the CL. In other words, copying the string
file:/home/user/foo.pdf#page=5&zoom=150,50,50
and pasting that straight into the URL bar will open the file the way I want in Brave.
This shortened command works from the CL:
$ brave-browser file:/home/user/foo.pdf#page=5
but adding the &zoom=150,50,50 provokes an error message from Brave.
I just can't get my head around how to format the rest of the line so that the file opens in the browser as intended (zoomed and focussed), when called from the CL.
I begin to wonder if that is possible at all.
I have tried everything that was suggested here:
Shell script to open a URL
and a couple of other ideas I had (mainly, creative use of quotation marks)
I also read this, but I am not sure if it refers to the same question - and the post is 11 years old. Was hoping that things changed:
Can a website pass focus to the browsers url field?
Thanks a lot for any help!
Just found out that all it takes is a backslash in front of the ampersand...
Strange: no matter how I do write that here, with the *** before and after the code, or without the three *** , I can never see the backslash in the post's preview!
browser file:/home/user/foo.pdf#page=5 \ &zoom=150,50,50
I have to type blanks before and after the hash to make it visible in this post as above. Looks wrong but this is the only way I can show what I mean. Also strange: the hash # works without the backslash \
Thanks, should someone have looked into this in the meantime!

Why does %20 become %2520 when I use a redirected url?

This works as expected - it returns one record:
https://terraref.ncsa.illinois.edu/bety/api/v1/search.json?sitename=~Season%204&limit=1
this does not
when I use the base url terraref.org rather than terraref.ncsa.illinois.edu:
https://terraref.org/bety/api/v1/search.json?sitename=~Season%204&limit=1
because in this second case the % is replaced by %25 and the query term is then not found.
Questions
How can I fix it?
Why has this appeared in the last few months and
Update
you can see question history for the red herring related to the R packages I was using
thanks to the comments, I've narrowed down the issue, I think
I've included tags ruby-on-rails and nginx because these are the tools that the api and server are using.
Somehow, you are encoding the value for sitename 2 times. In this example the decoded value is Season 4 when you encode first time Season%204and doing it the second time %20Season%25204.
Investigate the code to verify whether value for sitename already encoded and you doing it again.
Check Chrome DevTools to debug the problem.
Your call is being redirected with the following query parameters.
sitename: ~Season 4
limit: 1
If you choose the encoded view, you'll see the culprit.
So, as one might expect, it's just as simple as double url encoding.
If you need to use terraref.org as a base url, replace space with a plus.
https://terraref.org/bety/api/v1/search.json?sitename=~Season+4&limit=1

URL Escaping with Unity (Firebase URL)

I am trying to download a image stored in the Firebase Storage, using Unity. I use Unity Firebase SKD (in Beta...). This is my code:
...
// Points to "1/preview.jpg"
Firebase.Storage.StorageReference img_ref = folder1_ref.Child("/preview.jpg");
// Fetch the download URL
img_ref.GetDownloadUrlAsync().ContinueWith(task => {
Debug.Log(task.Result.ToString());
});
The console output is:
https://firebasestorage.googleapis.com/v0/b/insidehome-29c9e.appspot.com/o/1/preview.jpg?alt=media&token=092a8de8-5047-4bce-b179-edd4101847a3
If I try to download the file using www or a browser, with this URL, I obtain an error. The good URL should be (copied by Firebase console):
https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Finsidehome-29c9e.appspot.com%2Fo%2F1%2Fpreview.jpg%3Falt%3Dmedia%26token%3D092a8de8-5047-4bce-b179-edd4101847a3
The difference is only in a single slash ("/") before the word "preview".
Is this strange? How could I fix it? I try Escape the URL but it change all the slash:
https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Finsidehome-29c9e.appspot.com%2Fo%2F1%2F99%2Fobama.jpg%3Falt%3Dmedia%26token%3D8a33f998-e271-4d7e-8848-356a332b7750
And It does't work. I need to change only the parameters (right) slash
Hi Firebase engineer here. This is a bug and I'm sorry you encountered this. There should be no slash after "/o/". The 2 slashes surrounding the letter "o" are valid, but every forward slash after that should be displayed as %2F.
This is not a general escaping issue as you should not re-escape the entire URL. This is a side effect of a related mono issue in unity where the Uri class incorrectly decodes %2F into a slash when it shouldn't.
You can work around this by simply replacing slashes after "/o/" with %2F. However, you should know about a corresponding issue with UnityWebRequest:
https://issuetracker.unity3d.com/issues/unitywebrequest-dot-url-unescapes-escaped-symbol
where Unity's libraries are also being affected by this bug (so it may break even if you fix the string and pass it back to unity). It looks like that issue was fixed in 5.5.1 (and I've verified it in 5.6 beta).
On the firebase side, we will change our code to account for this issue in mono so it returns the correct url. Until we get this fix out, I suggest using the workaround of replacing slashes or simply use Firebase itself to download the file.
You can use Unity's WWW.EscapeURL to escape url.
string escapedUrl = WWW.EscapeURL("http://www.someurl");

Edit ‘JIRA Issues’ Macro , URL ---> fixVersion+%3D+6.0.0-beta3+ha1 gives syntax error

While including JIRA issues Macro on my Wikipage, I am having this issue.
On Jira, for a list of tickets, I have put the the Fix Version = 6.0.0-beta3+ha1 .
By doing so whenever I try to add JIRA Issue, with the following url
http://rdtrack/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=fixVersion+%3D+6.0.0-beta3+ha1&tempMax=1000
I get this message.
The JIRA Issue was not able to process the search. This may indicate a problem with the syntax of this macro.....
What is my understanding is that symbol "+" in 6.0.0-beta3+ha1 is causing this issue. I search on the Internet and found that using special characters like "+, etc.", they should be used within '' or " ". Still using them does solve my issue and I cannot see the list of JIRA tickets using URL mentioned above.
Escape the + as it's a reserved character and remove the unnecessary one from your query.
jqlQuery=fixVersion%3D6.0.0-beta3%2Dha1&tempMax=1000
Building on #rorschach's answer, try the following, which wraps quotes around the fixversion value (which is what you alluded to in your question).
jqlQuery=fixVersion%3D%226.0.0-beta3%2Dha1%22&tempMax=1000
Also, for a little bit more clarification on the +:
In JIRA, it does need wrapping in quotes... and in the URL, it's generally translated to a space. That's why you need to escape the + in the URL, but still quote the escaped fixversion value.

Allow special charcters in IIS request URLs

Currently, when I try to hit certain pages of my site via something like http://www.domain.com/< (which is a valid URL), I get a blank page with the text "Bad Request" on it (and nothing else). This happens with both the escaped and unescaped version of the URL.
I'm fairly certain this is due to IIS6 not liking the < character (which, in general, is valid). Is there a way to stop IIS6 from filtering these characters and giving me this error page?
(I've found similar solutions for IIS7, but nothing has worked in IIS6 so far.)
UPDATE: The URL is being transformed already, ie. hitting domain.com/%3C will also give the "Bad Request" page.
Not sure if this will work, but this got me out of a similar jam caused by design types forgetting key parts of query strings. Sounds like you might have a similar issue. Anyhow, try making a virtual directory called %3c and then having that redirect to where appropriate.
RFC 1738:
Thus, only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL.
< transforms to %3C
https://stackoverflow.com/<

Resources