例如,我想缩短这个url:https://docs.python.org/3/library/subprocess.html#popen-constructor
我试图将https://docs.python.org/3/library/subprocess.html#popen-constructor作为url参数传递,但返回的url实际上比https://docs.python.org/3/library/subprocess.html短,因此不会跳转到popen-构造函数部分。
然后,我尝试将https://docs.python.org/3/library/subprocess.html%23popen-constructor作为url参数传递,但是返回的url无法工作(404未找到)。
唯一的解决方案是使用TinyURL it self的网站,所以我想知道我是否可以用TinyURL api缩短包含"#“符号的url?
发布于 2020-05-10 20:48:34
注意:由于堆栈溢出安全规则,我不能添加微小的url。所以在下面的每一个例子中,我都用https://<tinyurl>.com替换了https://<tinyurl>.com
你应该编码整个目标网址,即:
https%3A%2F%2Fdocs.python.org%2F3%2Flibrary%2Fsubprocess.html%23popen-constructor然后,如果在完全编码目标url中使用api,它将创建一个正确的短链接:
https://<tinyurl>.com/api-create.php?url=https%3A%2F%2Fdocs.python.org%2F3%2Flibrary%2Fsubprocess.html%23popen-constructor

创建的Tinyurl (https://<tinyurl>.com/q3anmqb)将重定向到https://docs.python.org/3/library/subprocess.html#popen-constructor
https://stackoverflow.com/questions/61716693
复制相似问题