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

我想用Python写个自动为当前目录下面的视频文件搜索并下载射手网字幕的小脚本,求指引

  •  
  •   tedd · Oct 29, 2012 · 4844 views
    This topic created in 5097 days ago, the information mentioned may be changed or developed.
    Python大概知道怎么回事,但没有实际应用过,这次正是个好机会,请问大概需要怎么下手呢,用urllib2?我下面的伪代码如何:

    先来现在目标目录下面的文件作为例子

    Dexter.S07E05.HDTV.x264-ASAP.mp4
    Downton.Abbey.3x07.HDTV.x264-FoV.mp4
    Misfits.4x01.HDTV.x264-FoV.mp4
    The.Good.Wife.S04E05.HDTV.x264-LOL.[VTV].mp4

    1、读取到所有文件名
    2、用正则表达式将剧集实际名字读出来(这貌似要想一下怎么匹配,我看出的是'英文+数字',譬如S0之前的应该就是剧集名字)
    3、将剧集名称放到射手网的搜索链接中去,http://shooter.cn/search/Downton+Abbey/(貌似射手网没有公开的api可以调用,只有通过这种方式吧?)

    剩下的貌似就复杂了,又得用正则将搜索出来的结果筛选出来?然后进入该页面,模拟点击下载按钮?
    4 replies  •  1970-01-01 08:00:00 +08:00
    holmesabc
        1
    holmesabc  
       Oct 29, 2012
    应该是用requests + pyquery,简单点吧
    tedd
        2
    tedd  
    OP
       Oct 29, 2012
    @holmesabc 谢谢,都没有听说过,我搜搜看看去
    csx163
        3
    csx163  
       Oct 29, 2012
    @RavagerAlpha
    这位大师好像写了一个,你可以参考一下

    http://www.sunp.eu.org/t/51077
    duhastmich
        4
    duhastmich  
       Oct 30, 2012
    有个submarine,通过checksum 来的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3936 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 04:20 · PVG 12:20 · LAX 21:20 · JFK 00:20
    ♥ Do have faith in what you're doing.