Giter Club home page Giter Club logo

spider_python's Introduction

spider_python

抓取北邮人论坛和水木社区校招信息的爬虫程序, 直接运行main.py即可,非常简洁,可以扩展

程序依赖以下第三方Python包:requests, BeautifulSoup, redis-py

爬虫根据自定义关键字先对校招信息进行过滤,然后存储到本机redis中。本机若有lamp环境,可直接从redis读取信息到web页面上即可,lamp环境中的php程序示例如下:

<!DOCTYPE html>
<html>
<head>
<title>Welcome to spider!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
    }
    a:visited { color: red; }
</style>
</head>
<body>
<?php
$rs_ip = '127.0.0.1';
$rs_port = 6379;
$rs = new Redis();
$rs->connect($rs_ip, $rs_port);
$ret = $rs->smembers('urls');
foreach($ret as $herf) {
    echo $herf . "<br/>";
}
?>
</body>
</html>

效果截图:

1

此外,可以使用crontab或launchAgent(Mac OS X)把爬虫设定成定时任务,我的launchAgent如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/    DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.lzrak47.spider.plist</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/python</string>
        <string>/Users/lzrak47/project/python/spider_python/main.py</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>UserName</key>
    <string>lzrak47</string>
    <key>StartInterval</key>
    <integer>3600</integer>
</dict>
</plist>

Enjoy it。

spider_python's People

Contributors

lzrak47m4a1 avatar

Stargazers

 avatar

Watchers

 avatar  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.