Python:将这些 TinyURL(bit.ly、tinyurl、ow.ly)转换为完整 URL
我刚刚学习 python,对如何实现这一点很感兴趣。 在寻找答案的过程中,我遇到了这项服务: http://www.longurlplease.com
例如:
http://bit.ly/rgCbf 可以转换为:
http://webdesignledger.com/freebies/the-best-social-media-icons-all- in-one-place
我用 Firefox 做了一些检查,发现原始 url 不在标头中。
I am just learning python and is interested in how this can be accomplished. During the search for the answer, I came across this service: http://www.longurlplease.com
For example:
http://bit.ly/rgCbf can be converted to:
http://webdesignledger.com/freebies/the-best-social-media-icons-all-in-one-place
I did some inspecting with Firefox and see that the original url is not in the header.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
输入
urllib2
,它提供了最简单的方法:但作为参考,请注意,这也可以使用
httplib
:
还有
PycURL
,虽然我不确定如果这是使用它的最佳方法:Enter
urllib2
, which offers the easiest way of doing this:For reference's sake, however, note that this is also possible with
httplib
:And with
PycURL
, although I'm not sure if this is the best way to do it using it: