推荐学习书目
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
hiddenstrawberry
V2EX  ›  Python

美团(猫眼)电影票价/信息爬虫

  •  
  •   hiddenstrawberry · Aug 10, 2017 · 2753 views
    This topic created in 3247 days ago, the information mentioned may be changed or developed.

    美团电影爬虫 /美团电影价格图片混淆破解

    https://github.com/HiddenStrawberry/meituan-movie-price-crawler

    项目难点:


    让我们先来随便打开一个美团电影的页面

    此处输入图片的描述

    真是美滋滋啊,这个价格就写在上面!爬下来不就得了。

    定睛一看代码,我了个擦,这是个什么东西。

    此处输入图片的描述

    打开图片 URL,才明白过来,原来是一张大图一堆数字,用 CSS 定位的具体数字,美团你为了反爬真是煞费苦心啊……

    此处输入图片的描述


    Cracked


    requirement:

    bs4 requests Pillow/PIL

    需要独立安装 tesseract-ocr

    使用方法:

    1. 安装 tesseract-ocr
    2. 将 num.traineddata 复制粘贴到 tesseract 的 tessdata 目录中
    3. 修改 meituan_price_img.py 中的 TESSERACT_PATH 变量定位到 tesseract.exe (绝对路径)
    4. 打开 meituan.py ,Enjoy it !

    Example:

    print get_city_url('上海') #获取城市的地址
    print get_all_cinema('sh.meituan.com') #获取城市所有电影院信息
    print get_cinema_movie('http://sh.meituan.com/shop/58174') #获取指定电影院所有电影场次信息
    

    原理:

    你都看到 tesseract-ocr 了原理还用我废话嘛?机器学习了所有数字的样本(精准到 1px ),然后自动识别并输出咯。 PS:如果价格有手机专享价,会自动输出手机专享价!

    sunwei0325
        1
    sunwei0325  
       Aug 12, 2017
    验证码是不是也可以用这个库来搞事呢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5489 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 58ms · UTC 09:05 · PVG 17:05 · LAX 02:05 · JFK 05:05
    ♥ Do have faith in what you're doing.