3

TripAdvisor.com景点页面上,景点网站的链接似乎以某种方式加密。这是一个例子:

<span class="taLnk hvrIE6" onclick="ta.trackEventOnPage('AttractionContactInfo',
'Website', 1755031, 1); ta.util.cookie.setPIDCookie(15190);
ta.call('ta.util.link.targetBlank', event, this
{'aHref':'LqMWJQiMnYQQoqnQQxGEcQQoqnQQbIIEJnISiCQQoqnQQeVsSVuWJQzZYUWJQpEcYGII26XombQQoqnQQQQoqnqgoqnQQQQoqnQQQQoqnQQQQoqnqgoqnQQQQoqnQQEVMIGVJIEV9pCyTptGiuQQoqnQQQQoqnxioqnQQQQoqnQQniaWJQzhY3mJnJUUJXomoAvoJJB', 'isAsdf':true})">
    Website
</span>

这个链接是如何建立的,这样做的原因可能是什么?

4

2 回答 2

6

aHref 值是可以使用 TripAdvisor asdf() Javascript 函数解密的加密 URL。例如,使用 Firefox 中的 Javascript 控制台,在 www.tripadvisor.com 上键入以下内容:

console.log(asdf('加密的 URL'));

一个例子:

console.log(asdf('LqMWJQzZYUWJQpEcYGII26XombQQoqnQQQQoqnqgoqnQQQQoqnQQQQoqnQQQQoqnqgoqnQQQQoqnQQuuuQQoqnQQQQoqnxioqnQQQQoqnQQEitVuiiMqxQQoqnQQQQoqnxioqnQQQQoqnQQniaQQoqnQQQQoqnqgoqnQQQQoqnQQVCQQoqnQQQQoqnqgoqnQQQQoqnQQIGVQQoqnQQQQoqnqHoqnQQQQoqnQQnJEcgcVQQoqnQQQQoqnqHoqnQQQQoqnQQCVuQQoqnQQQQoqnqHoqnQQQQoqnQQgiE9QQoqnQQQQoqnqgoqnQQQQoqnQQMSCSCyQQoqnQQQQoqnqgoqnQQQQoqnQQHVaVcaJCtQQoqnQQQQoqnqHoqnQQQQoqnQQHJEWJQzhYUMo3JKHkmKnVmJVdUB'));

给出以下内容(附加到http://tripadvisor.com):

/ShowUrl-a_partnerKey.1-a_url.http%253A__5F____5F__2F__5F____5F____5F____5F__2F__5F____5F__www__5F____5F__2E__5F____5F__rosewoodhotels__5F____5F__2E__5F____5F__com__5F____5F__2F__5F____5F__en__5F____5F__2F__5F____5F__the__5F____5F__2D__5F____5F__carlyle__5F____5F__2D__5F____5F__new__5F____5F__2D__5F____5F__york__5F____5F__2F__5F____5F__dining__5F____5F__2F__5F____5F__bemelmans__5F____5F__2D__5F____5F__bar-a_urlKey.1d56a0b730ce3ae41.html

TripAdvisor asdf() 函数的来源:

function asdf(d) {
var h = {
    "": ["&", "=", "p", "6", "?", "H", "%", "B", ".com", "k", "9", ".html", "n", "M", "r", "www.", "h", "b", "t", "a", "0", "/", "d", "O", "j", "http://", "_", "L", "i", "f", "1", "e", "-", "2", ".", "N", "m", "A", "l", "4", "R", "C", "y", "S", "o", "+", "7", "I", "3", "c", "5", "u", 0, "T", "v", "s", "w", "8", "P", 0, "g", 0],
    q: [0, "__3F__", 0, "Photos", 0, "https://", ".edu", "*", "Y", ">", 0, 0, 0, 0, 0, 0, "`", "__2D__", "X", "<", "slot", 0, "ShowUrl", "Owners", 0, "[", "q", 0, "MemberProfile", 0, "ShowUserReviews", '"', "Hotel", 0, 0, "Expedia", "Vacation", "Discount", 0, "UserReview", "Thumbnail", 0, "__2F__", "Inspiration", "V", "Map", ":", "@", 0, "F", "help", 0, 0, "Rental", 0, "Picture", 0, 0, 0, "hotels", 0, "ftp://"],
    x: [0, 0, "J", 0, 0, "Z", 0, 0, 0, ";", 0, "Text", 0, "(", "x", "GenericAds", "U", 0, "careers", 0, 0, 0, "D", 0, "members", "Search", 0, 0, 0, "Post", 0, 0, 0, "Q", 0, "$", 0, "K", 0, "W", 0, "Reviews", 0, ",", "__2E__", 0, 0, 0, 0, 0, 0, 0, "{", "}", 0, "Cheap", ")", 0, 0, 0, "#", ".org"],
    z: [0, "Hotels", 0, 0, "Icon", 0, 0, 0, 0, ".net", 0, 0, "z", 0, 0, "pages", 0, "geo", 0, 0, 0, "cnt", "~", 0, 0, "]", "|", 0, "tripadvisor", "Images", "BookingBuddy", 0, "Commerce", 0, 0, "partnerKey", 0, "area", 0, "Deals", "from", "\\", 0, "urlKey", 0, "'", 0, "WeatherUnderground", 0, "MemberSign", "Maps", 0, "matchID", "Packages", "E", "Amenities", "Travel", ".htm", 0, "!", "^", "G"]
};
var b = "";
for (var a = 0; a < d.length; a++) {
    var j = d.charAt(a);
    var f = j;
    if (h[j] && a + 1 < d.length) {
        a++;
        f += d.charAt(a)
    } else {
        j = ""
    }
    var g = getOffset(d.charCodeAt(a));
    if (g < 0 || typeof h[j][g] == "String") {
        b += f
    } else {
        b += h[j][g]
    }
}
return b}

以及从 asdf() 引用的 getOffset() 函数的来源:

function getOffset(a) {
if (a >= 97 && a <= 122) {
    return a - 61
}
if (a >= 65 && a <= 90) {
    return a - 55
}
if (a >= 48 && a <= 71) {
    return a - 48
}
return -1}
于 2015-04-08T13:14:00.233 回答
0

可以这样做以防止屏幕抓取工具和机器人自动产生到其他站点的流量。

一些服务器端代码生成了这个,它用于跟踪、统计和设置一些 cookie 值等。

Trip Advisor 将能够确定点击了哪些链接,并与景点共享此信息(即 50 人从 Trip Advisor 网站访问您的网站等)

希望有用

于 2013-11-13T14:11:35.230 回答