Skip to main content

Add your description here

Project description

DiiDu爬虫-python版本

尽力做到了对操作, 使用的还原.

使用

  • config的配置

    • 要求
config = {
    'base_url': '...',  <-- 爬虫入口
    'content': {  <-- 用于划分主要区域
        'spilt_func': 'extract_content',
        'spilt_args': [
            '<div class="box1">', 
            '<div id="div_vote_id"></div>'
        ]
    },
    'value':{
        '标题'<--字段名: {
            'spilt_func': 'extract_content', <-- 使用的函数(暂时只有extract_content)
            'spilt_args': [
                '<p class="bt">',  <-- 参数
                '</p>'
            ]
        },
        ...可以自行添加其他字段名
    },
    'Next':{  <-- 下一页的配置
        'css':'a.Next',
        'name':'下页'  <-- 如果a.Next不唯一, 则可以根据name来筛选
    },
    'son':{
        'css': '.p2_right>ul>li>a'  <-- 子标签的css选择器
    }
}
    • 示例
config = {
    'base_url': '...',
    'content': {
        'spilt_func': 'extract_content',
        'spilt_args': [
            '<div class="box1">', 
            '<div id="div_vote_id"></div>'
        ]
    },
    'value':{
        '标题': {
        'spilt_func': 'extract_content',
        'spilt_args': [
            '<p class="bt">',
            '</p>'
        ]
        },
        '发布时间': {
        'spilt_func': 'extract_content',
        'spilt_args': [
            '<p>发布时间:',
            '</p>'
        ]
        },
        '正文内容': {
        'spilt_func': 'extract_content',
        'spilt_args': [
            '<div class="v_news_content">',
            '</div>'
        ]
        }
    },
    'Next':{
        'css':'a.Next',
        'name':'下页'
    },
    'son':{
        'css': '.p2_right>ul>li>a'
    }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zut_spider-0.1.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file zut_spider-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: zut_spider-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for zut_spider-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa651593a8581fac1dfcb3bb75ffc417bd59542651cdd903f0ae48d3a63bdcd0
MD5 b01fe4f1c12867fdea9937f866e6af7e
BLAKE2b-256 a8ade2fdf6847df99395427c43e5b926dbb55ae368b2e4b4a747bcf0b53aaa06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page