问题标签 [url-shortener]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1477 浏览

java - 是否有任何适用于 Android 的 bit.ly 库?

有没有可以为 Android/Java 缩短 bit.ly URL 的库?

0 投票
3 回答
7452 浏览

php - 使用 Bitly API 缩短 URL

我在这个网站上找到了下面的 Bitly API 代码。我很难让它创建并回显一个名为 $fullurl 的变量的位缩短 URL。我该怎么做?

编辑:没有出现错误代码,只是没有显示缩短的 URL。

编辑 2: var_dump($response);返回 NULL

编辑 3:我确实用我的替换了 API 登录名和密钥。

编辑 4:我在原始教程的评论之一中找到了答案。对于所有 PHP 专业人士来说,我的问题太基本了:我只需要echo bitly_shorten($fullurl);在最后添加。

提前致谢,

约翰

0 投票
3 回答
1584 浏览

java - 解决 Android 中缩短的 url

如何将缩短的 url (bit.ly/dfasdfasf) 解析为 android 中的重定向 url?

0 投票
2 回答
1600 浏览

jquery - 谷歌网址缩短器不返回网址

我只是想进行一个简单的 ajax 调用来使用谷歌的 url 缩短器来缩短一个 url,但它没有返回任何数据。有人有想法么?

我有一个 API 密钥,但我没有把它放在这里。而且您不需要使用该服务。

0 投票
3 回答
2370 浏览

jquery - jQuery URL bit.ly 缩短器

有人可以帮我使用这个 jQuery bit.ly URL 缩短器吗?

代码如下:

每当我运行脚本时,它都会在控制台中返回此代码:

0 投票
2 回答
3625 浏览

android - 如何使用谷歌缩短器 api 创建缩短网址

我正在尝试使用 google 缩短器 api 缩短 url,我碰巧在 google 上找到了可以帮助我的东西,但我没有找到可以帮助我的博客或 java/android 上的东西。如果有人有更好的资源,请建议我。这是我的代码

}

由于这条线,我一直面临逼近。

有什么建议么?

如果它提供任何帮助,这是我的堆栈跟踪。

0 投票
3 回答
898 浏览

web - 有没有办法“展开” URL Shorteners?

URL Shorteners 在空间受限的媒体(如 Twitter)中很有用。但此类的危险已得到充分讨论(寿命有限、隐藏恶意链接、可用性等)。但是有没有一种很好的方法来预先解析来自 goo.gl 或 bit.ly 等服务的缩短 URL?我想在用户在我的网站/社区上输入它们时执行此操作。

0 投票
1 回答
59 浏览

database - 在处理(创建/提供)自定义短网址时我应该采取什么方法?

需要一个建议!这是我对 url 缩短的了解:通常新记录 id 是从数据库中获取并转换为某种东西,比如说 base 36 ...

我的情况:我需要在 URL 缩短以及自动生成的 url 中具有附加功能,我还需要能够处理自定义 url。

示例:用户输入: http: //google.com 并希望拥有短网址“domain/my-google”。

问题:乍一看一切都很好,但我担心扩展,因为 url 将存储 90 天并且数据库记录是否会增长!我可能会遇到一些性能问题!

那么问题来了:在处理(创建/提供)自定义短网址时我应该采取什么方法?

0 投票
4 回答
1548 浏览

algorithm - Will this obfuscation algorithm for a URL shortener work?

DISCLAIMER: I am not asking how to make a URL shortener (I have already implemented the "bijective function" answer found HERE that uses a base-62 encoded string). Instead, I want to expand this implementation to obfuscate the generated string so that it is both:

A) not an easily guessable sequence, and

B) still bijective.

You can easily randomize your base-62 character set, but the problem is that it still increments like any other number in any other base. For example, one possible incremental progression might be {aX9fgE, aX9fg3, aX9fgf, aX9fgR, … ,}

I have come up with an obfuscation technique that I am pleased with in terms of requirement A), but I'm only partially sure that it satisfies B). The idea is this:

The only thing that is guaranteed to change in the incremental approach is the "1's place" (I'll use decimal terminology for practicality reasons). In the sample progression I gave earlier, that would be {E, 3, f, R, …}. So if each character in the base-62 set had its own unique offset number (say, its distance from the "zero character"), then you could apply the offset of the "1's place" character to the rest of the string.

For instance, let's assume a base-5 set with characters {A, f, 9, p, Z, 3} (in ascending order from 0 to 5). Each one would then have a unique offset of 0 to 5 respectively. Counting would look like {A, f, 9, p, Z, 3, fA, ff, f9, fp, …} and so on. So the algorithm, when given a value of fZ3p, would look at the p and, having an offset of +3, would permute the string into Zf9p (assuming the base-5 set is a circular array). The next incremental number would be fZ3Z, and with Z's offset being +4, the algorithm returns 39pZ. These permutated results would be handed off to the user as his/her "unique URL", who would never see the actual base-62 encoded string.

This approach certainly seems reversible; just look at the last character, and perform the same permutation with the negative offset. And I'm thinking that for this reason, it has to still be bijective. But I don't know if this is necessarily true? Are there any edge/corner cases I'm not considering?

EDIT : My intentions are more heavily weighed towards the length of the shortened-URL rather than the security of the pattern. I realize there are plenty of solutions involving cryptographic functions, block ciphers, etc. But I would like to emphasize that I am not asking the best way to achieve A), but rather, "is my offset-approach satisfying B)".

Any holes you can find would be appreciated.

0 投票
5 回答
5626 浏览

php - PHP - 只有 4 位的唯一散列函数(不需要精确)

我正在构建一个简单的 URL 缩短脚本,我想对 URL 进行哈希处理以用作唯一 ID,但如果我使用 MD5 之类的东西,则 URL 不会很短。

他们是一些散列函数还是创建一个只有 4 位或 5 位数字长的唯一 ID?