V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
youxiao
V2EX  ›  Python

这个 url 后缀是什么规则生成的?

  •  
  •   youxiao · 2018-01-02 11:16:49 +08:00 · 2397 次点击
    这是一个创建于 2299 天前的主题,其中的信息可能已经有所发展或是发生改变。
    https://chengyu.911cha.com/dWQy.html
    https://chengyu.911cha.com/NTZv.html
    https://chengyu.911cha.com/M2dnYQ==.html

    其中 dWQy、NTZv、M2dnYQ==是什么规则生成的呢?
    base64decode 后的值也看不出来。
    5 条回复    2018-01-03 14:18:29 +08:00
    Chappako
        1
    Chappako  
       2018-01-02 11:22:28 +08:00
    hashids
    youxiao
        2
    youxiao  
    OP
       2018-01-02 11:42:44 +08:00
    @Chappako 也就是说没办法通过这个 url 找回原始 id 了吧?
    vjnjc
        3
    vjnjc  
       2018-01-02 14:32:28 +08:00   ❤️ 1
    @youxiao 应该是数据库里面的一条记录,除非你有数据库,不然找不到相互关系
    summerwar
        4
    summerwar  
       2018-01-02 18:33:43 +08:00
    没有关系,随机的 4 位或者多位字符来做 url 而已,这样子可以让 url 看起来比较短
    xpresslink
        5
    xpresslink  
       2018-01-03 14:18:29 +08:00
    这个规律肯定是不好找的,或说根本没有规律只是随机生成,和这个成语没有关系,可能是数据库的 id 有对应。
    对应关系也许不是用算法或函数,只是用个关系表.

    很明显这个网站做了静态化, 全部网页都是生成好的. 一个原因是反爬, 另一个就是提高性能.
    你只能按字数分类页, 直接把链接解析出来再爬.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   918 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 20:40 · PVG 04:40 · LAX 13:40 · JFK 16:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.