如何使用带有URL查询字符串的Wayback Machine API?

时间:2021-04-21 16:39:05

I'm trying to get information with the wayback machine API.

我正在尝试使用wayback机器API获取信息。

The webpage I'm testing the API with is :

我正在测试API的网页是:

http://www.ifop.com/?option=com_publication&type=poll&id=3367

As you can see here, the webpage is already archived :

如您所见,该网页已存档:

https://web.archive.org/web/*/http://www.ifop.com/?option=com_publication&type=poll&id=3367

So when I'm using the API :

所以当我使用API​​时:

http://archive.org/wayback/available?url=http://www.ifop.com/?option=com_publication&type=poll&id=3367

I should get my information but the API answer is empty as if the webpage wasn't archived...

我应该获取我的信息,但API答案是空的,好像网页没有存档...

{"archived_snapshots":{}}

I tried to replace & with & but it's still empty...

我试图替换和&但它还是空的......

So my question is : how to use the Wayback Machine API with URL query string ?

所以我的问题是:如何使用带有URL查询字符串的Wayback Machine API?

1 个解决方案

#1


1  

Problem:
The ampersands, even in &, are parsed as additional parameters to the API rather than as part of the url parameter.

问题:即使在&中,&符号也被解析为API的附加参数,而不是作为url参数的一部分。

Solution:
Use %26 to encode the ampersand. Similarly encode the rest of the URL.

解决方案:使用%26编码&符号。同样编码URL的其余部分。

Your request becomes: http://archive.org/wayback/available?url=http%3A%2F%2Fwww.ifop.com%2F%3Foption%3Dcom_publication%26type%3Dpoll%26id%3D3367

您的请求变为:http://archive.org/wayback/available?url = http%3A%2F%2Fwww.ifop.com%2F%3Foption%3Dcom_publication%26type%3Ddoll%26id%3D3367

#1


1  

Problem:
The ampersands, even in &, are parsed as additional parameters to the API rather than as part of the url parameter.

问题:即使在&中,&符号也被解析为API的附加参数,而不是作为url参数的一部分。

Solution:
Use %26 to encode the ampersand. Similarly encode the rest of the URL.

解决方案:使用%26编码&符号。同样编码URL的其余部分。

Your request becomes: http://archive.org/wayback/available?url=http%3A%2F%2Fwww.ifop.com%2F%3Foption%3Dcom_publication%26type%3Dpoll%26id%3D3367

您的请求变为:http://archive.org/wayback/available?url = http%3A%2F%2Fwww.ifop.com%2F%3Foption%3Dcom_publication%26type%3Ddoll%26id%3D3367