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.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zut_spider-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 964ac9587ebbb8b1d1c269c1d072311b5706bffb38d5a75a3b70e3bd47a60223
MD5 009e9d9c07832cde1fc9226593d311c3
BLAKE2b-256 676ebd560f65a5fe50b83d84ac8f7ca44609d4e07117a5a86f747fac024d1791

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