Giter Club home page Giter Club logo

pixiv's Introduction

P 站非会员查看人气作品

这个项目来源于我的一篇文章 缺手机壁纸?来看看:也来看看 下面的一条评论

其实一开始我是不知道 P 站是什么

某度了一下,原来是日本一个插画网站,但是这个网站看人气作品是要会员的。

然后我就又有个大胆的想法了,把插图的的连接和 star 数爬取下来,然后进行排序,这样就可以看到人气高的作品了。

第一次爬取网站内容,发现没有插图内容,应该是要保持登录状态才行。为此我注册了个账号,目的是为了获取 cookies。F12 获取 cookies

将 cookies 保存在项目下的 cookies.txt 文件里。在代码中组装 cookies 内容

def cookies(self):
    with open("cookies.txt", 'r') as f:
        _cookies = {}
        for row in f.read().split(';'):
            k, v = row.strip().split('=', 1)
            _cookies[k] = v
        return _cookie

测试一下,爬取 'summer' 关键词前 500 页信息。

urls = get_urls("summer", 500)

效果如下

点击排第一的连接

诚不欺我,确实高人气
不过这个单线程版本(pixiv.py)爬取太多页的话速度有点慢,所以又写了个多线程版本的(pixiv_.py),速度蹭蹭就上去了。

技术本身是无罪的。 —— 原快播CEO王欣

当然还是希望有能力的同学支持下这个网站,充个会员。但是,我!就!不!

pixiv's People

Contributors

chenjiandongx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.