V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
niuoh
V2EX  ›  Linux

用 py 写了个知乎的命令行版

  •  
  •   niuoh · 2018-05-10 14:35:27 +08:00 · 4367 次点击
    这是一个创建于 2171 天前的主题,其中的信息可能已经有所发展或是发生改变。

    http://wx1.sinaimg.cn/large/006IuJZAgy1fr68b2d2iog30ua0ikhdt.gif
    只是为了逛知乎的时候更隐蔽点
    我开源到 coding 上你们没意见吧
    https://coding.net/u/niuoh/p/zhihu_cmd/git?public=true

    18 条回复    2018-05-10 16:26:35 +08:00
    PureWhite
        1
    PureWhite  
       2018-05-10 14:37:09 +08:00
    你怎么能只爬知乎在广告区插入的回答呢?
    niuoh
        2
    niuoh  
    OP
       2018-05-10 14:38:27 +08:00
    @PureWhite 整个脚本调用了知乎的两个 api 搜索问题的 api 和 获取答案的 api 广告跟我无关啊
    PureWhite
        3
    PureWhite  
       2018-05-10 14:39:34 +08:00
    @niuoh 23333 看来你没懂,知乎之前不是在广告区插入回答和评论来着(逃
    eloah
        4
    eloah  
       2018-05-10 14:41:18 +08:00
    @PureWhite
    二营长,你他娘的意大利......面呢,拿上来让友军尝尝
    lzhd24
        5
    lzhd24  
       2018-05-10 14:43:38 +08:00
    利用这个接口是不是可以做的 web 页面?
    niuoh
        6
    niuoh  
    OP
       2018-05-10 14:49:07 +08:00
    @lzhd24 那为啥不直接访问知乎啊
    PureWhite
        7
    PureWhite  
       2018-05-10 14:49:09 +08:00
    @eloah 报告团长,![]( https://static.purewhite.io/images/2018-05-10-064745.png) 点击就送意大利面!
    opengps
        8
    opengps  
       2018-05-10 14:57:58 +08:00
    看着很干净啊,无广告版阅读确实不错
    v2register
        9
    v2register  
       2018-05-10 15:58:30 +08:00
    ```
    Microsoft Windows XP [版本 5.1.2600]
    (C) 版权所有 1985-2001 Microsoft Corp.

    E:\VMware>python zhihu.py
    search question >方正
    'utf8' codec can't decode byte 0xb7 in position 51: invalid start byte

    E:\VMware>python zhihu.py
    search question >v2ex
    'clear' 不是内部或外部命令,也不是可运行的程序
    或批处理文件。
    20538971 V2EX 怎样影响了你?
    19614186 V2EX.com 的价值在哪?
    19558757 V2EX 是否是知乎的竞争对手?
    19551071 刘昕是如何设计 V2EX 的?最初的想法是什么?
    270687757 如何看待 V2EX 未经允许公布用户邮箱和手机号?
    19622060 知乎和 V2EX 相比有哪些差异,哪个更让用户舒服,为什么?
    21521104 三个基于 Python 的网站:知乎、豆瓣、V2EX 都存在卡顿的问题,是 Python 的
    问题吗?
    19754033 用 V2EX DNS 从 App Store 下载为什么这么快?
    21225502 V2EX 和 discuz 这样的论坛的区别是什么 优缺点各是什么?
    20576614 如何评价 hackerTom 发表于 V2EX.com 的《十个不选择创新工场的理由》?
    select question >20538971
    comment id:256256029
    'gbk' codec can't encode character u'\u2022' in position 208: illegal multibyte
    sequence

    E:\VMware>
    ```
    万恶的 windows:(
    niuoh
        10
    niuoh  
    OP
       2018-05-10 16:03:58 +08:00
    @v2register 对 忘记说了  windows 下 把 os.system('clear') 改成 os.system('cls')
    把 #coding=utf-8 改成 #coding=gbk
    lieh222
        11
    lieh222  
       2018-05-10 16:11:51 +08:00
    我想看图和小视频
    niuoh
        12
    niuoh  
    OP
       2018-05-10 16:13:16 +08:00
    @lieh222 在命令行下你得学会慢慢放弃这些东西
    albertofwb
        13
    albertofwb  
       2018-05-10 16:17:54 +08:00 via Android
    有没有 V2 的命令行版本?
    niuoh
        14
    niuoh  
    OP
       2018-05-10 16:21:54 +08:00
    @albertofwb google 一下你就知道
    zdnyp
        15
    zdnyp  
       2018-05-10 16:23:58 +08:00
    @niuoh 知乎的 API 是抓包的还是官方提供的嘞?想看看
    niuoh
        16
    niuoh  
    OP
       2018-05-10 16:24:47 +08:00
    @zdnyp f12 抓包的
    zdnyp
        17
    zdnyp  
       2018-05-10 16:25:13 +08:00
    @zdnyp 看源码像是抓包的哇
    zdnyp
        18
    zdnyp  
       2018-05-10 16:26:35 +08:00
    @niuoh 学习学习:)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   989 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 22:48 · PVG 06:48 · LAX 15:48 · JFK 18:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.