Home php教程 php手册 dede3.1分页文字采集过滤规则详说(图文教程)续四

dede3.1分页文字采集过滤规则详说(图文教程)续四

Jun 13, 2016 pm 12:32 PM
content Pagination match Graphics and text Tutorial letter article rule filter conduct collection

至此,分页内容匹配进行完毕。 

文章内容匹配、分页内容匹配都进行完后,最后就只有“过滤”了,包括分页区域过滤和文章内容过滤。据本人的感觉,上面的两个规则都好写,只要找到全部链接中的“唯一性”代码就搞定,但过滤规则里却是欲说还休,道不尽的无穷奥妙……哈哈,感觉就是这样。尤其如我一般的新手,对“正则”这个东西如临天书,找了几个正则方面的软件吧仍觉无从下手,就只好依样画样,照猫画虎,依葫芦画瓢地摸索了。 

好了,闲话了。也累了,听听《加州旅馆》吧,在这:加州旅馆_老鹰乐队94现场 放松下吧。

你一眼看出来了过滤规则怎么写么,反正我是没能看得出来,没办法,新手就是新手呀。不管它,那就依照原范例的分页过滤规则写个规则试试看看结果吧:

复制代码 代码如下:


{dede:trim}

(.*)页次{/dede:trim}

采集一下:

=700) window.open('/upload/200743213556612.gif');" src="http://www.bkjia.com/uploads/allimg/131016/06063112Q-0.gif" onload="if(this.width>'700')this.width='700';" border=0>
分页成功了,但废码多,还得改!
看下多余的代码特征,好象是过滤范围不够,后面的很多内容都要过滤掉。那好,把过滤区域再往后移,直接移至描红部分吧(其实我在改过滤规则的时候,改了好几次,这里就一次到位吧,不耽误朋友们的时间了):

=700) window.open('/upload/200743213556171.gif');" src="http://www.bkjia.com/uploads/allimg/131016/0606314629-1.gif" onload="if(this.width>'700')this.width='700';" border=0>
写个完整的分页过滤规则:

复制代码 代码如下:


{dede:trim}

(.*){/dede:trim} 

再采集下,看看结果:

=700) window.open('/upload/200743213556537.gif');" src="http://www.bkjia.com/uploads/allimg/131016/0606314A6-2.gif" onload="if(this.width>'700')this.width='700';" border=0>

好了,分页成功,无多余代码。至此,全部主要的代码部分完成。
结果在这里:
有分页的:党员干部作风整顿剖析材料
无分页的: 文艺部工作计划
写一个完成的站点规则:

复制代码 代码如下:


{!-- 节点基本信息 --}

{dede:item name='天水_工作计划_1页'
    imgurl='/upimg' imgdir='../upimg' language='gb2312' typeid='1' macthtype='string'}
{/dede:item}

{!-- 采集列表获取规则 --}

{dede:list source='var' sourcetype='list' 
          varstart='' varend=''}
  {dede:url value='http://www.tiansou.net/Html/Y_CYFW/R_Gzzj/F_Gzjh/index.html'}{/dede:url}    
  {dede:need}Gzjh/2007-{/dede:need}
  {dede:cannot}Gzjh/2007-1{/dede:cannot}
  {dede:linkarea}[var:区域]{/dede:linkarea}
{/dede:list}

{!-- 网页内容获取规则 --}

{dede:art}
{dede:sppage sptype='full'}

首页 上页[var:分页区域]页次{/dede:sppage}

  {dede:note field='dede_archives.title' value='[var:内容]' comment='文章标题' 
  isunit='' isdown=''}

    {dede:match}[var:内容]--天水搜索{/dede:match}

    {dede:function}{/dede:function}

  {/dede:note}

  {dede:note field='dede_archives.sortrank' value='[var:内容]' comment='排序级别' 
  isunit='' isdown=''}

    {dede:match}{/dede:match}

    {dede:function}@me = time();{/dede:function}

  {/dede:note}

  {dede:note field='dede_archives.writer' value='[var:内容]' comment='文章作者' 
  isunit='' isdown=''}

    {dede:match}{/dede:match}

    {dede:function}{/dede:function}

  {/dede:note}

  {dede:note field='dede_archives.litpic' value='[var:内容]' comment='缩略图' 
  isunit='' isdown=''}

    {dede:match}{/dede:match}

    {dede:function}@me = @litpic;{/dede:function}

  {/dede:note}

  {dede:note field='dede_archives.pubdate' value='[var:内容]' comment='发布时间' 
  isunit='' isdown=''}

    {dede:match}{/dede:match}

    {dede:function}if(@me!="") @me = GetMkTime(@me);
else @me = time();{/dede:function}

  {/dede:note}

  {dede:note field='dede_archives.senddate' value='[var:内容]' comment='录入时间' 
  isunit='' isdown=''}

    {dede:match}{/dede:match}

    {dede:function}@me = time();{/dede:function}

  {/dede:note}

  {dede:note field='dede_addonarticle.body' value='[var:内容]' comment='文章内容' 
  isunit='1' isdown='1'}

    {dede:match}
              
                
              
              
                

[var:内容]


                  
              {/dede:match}
        {dede:trim}(.*){/dede:trim}
    {dede:trim}
{/dede:trim}
    {dede:trim}]*)>{/dede:trim}
    {dede:trim}]*)>([^>]*){/dede:trim}
    {dede:trim}]*)>{/dede:trim}
    {dede:trim}{/dede:trim}
    {dede:trim}]*)>([^>]*){/dede:trim}
    {dede:trim}]*)>{/dede:trim}
    {dede:trim}
{/dede:trim}
    {dede:trim}]*)>([^>]*){/dede:trim}
    {dede:trim}]*)>{/dede:trim}
    {dede:trim}
{/dede:trim}
    {dede:trim}{/dede:trim}
    {dede:trim}{/dede:trim}
    {dede:trim}{/dede:trim}
    {dede:trim}{/dede:trim}
    {dede:trim}]*)>([^{/dede:trim}
    {dede:trim}]*)>{/dede:trim}
    {dede:trim}
{/dede:trim}
    {dede:trim}dede3.1分页文字采集过滤规则详说(图文教程)续四]*)>{/dede:trim}
    {dede:trim}]*)>([^{/dede:trim}
    {dede:trim}
]*)>{/dede:trim}
    {dede:trim}
{/dede:trim}
    {dede:trim}
]*)>([^>]*){/dede:trim}
    {dede:trim}]*)>{/dede:trim}
    {dede:trim}{/dede:trim}
    {dede:trim}]*)>([^>]*){/dede:trim}
    {dede:trim}]*)>{/dede:trim}
    {dede:trim}{/dede:trim}
    {dede:trim}]*)>([^>]*){/dede:trim}
    {dede:trim}{/dede:trim}
    {dede:trim}{/dede:trim}
    {dede:trim}]*)>([^>]*)
{/dede:trim}
    {dede:trim}]*)>{/dede:trim}
    {dede:trim}
{/dede:trim}
    {dede:trim} {/dede:trim}

    {dede:function}{/dede:function}

  {/dede:note}

  {dede:note field='dede_archives.source' value='[var:内容]' comment='文章来源' 
  isunit='' isdown=''}

    {dede:match}{/dede:match}

    {dede:function}@me ='互联网'{/dede:function}

  {/dede:note}
{/dede:art}


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to make round pictures and text in ppt How to make round pictures and text in ppt Mar 26, 2024 am 10:23 AM

First, draw a circle in PPT, then insert a text box and enter text content. Finally, set the fill and outline of the text box to None to complete the production of circular pictures and text.

Tutorial on how to use Dewu Tutorial on how to use Dewu Mar 21, 2024 pm 01:40 PM

Dewu APP is currently a very popular brand shopping software, but most users do not know how to use the functions in Dewu APP. The most detailed usage tutorial guide is compiled below. Next is the Dewuduo that the editor brings to users. A summary of function usage tutorials. Interested users can come and take a look! Tutorial on how to use Dewu [2024-03-20] How to use Dewu installment purchase [2024-03-20] How to obtain Dewu coupons [2024-03-20] How to find Dewu manual customer service [2024-03-20] How to check the pickup code of Dewu [2024-03-20] Where to find Dewu purchase [2024-03-20] How to open Dewu VIP [2024-03-20] How to apply for return or exchange of Dewu

How to add dots to text in word? How to add dots to text in word? Mar 19, 2024 pm 08:04 PM

When we create Word documents on a daily basis, we sometimes need to add dots under certain words in the document, especially when there are test questions. To highlight this part of the content, the editor will share with you the tips on how to add dots to text in Word. I hope it can help you. 1. Open a blank word document. 2. For example, add dots under the words "How to add dots to text". 3. We first select the words "How to add dots to text" with the left mouse button. Note that if you want to add dots to that word in the future, you must first use the left button of the mouse to select which word. Today we are adding dots to these words, so we have chosen several words. Select these words, right-click, and click Font in the pop-up function box. 4. Then something like this will appear

In summer, you must try shooting a rainbow In summer, you must try shooting a rainbow Jul 21, 2024 pm 05:16 PM

After rain in summer, you can often see a beautiful and magical special weather scene - rainbow. This is also a rare scene that can be encountered in photography, and it is very photogenic. There are several conditions for a rainbow to appear: first, there are enough water droplets in the air, and second, the sun shines at a low angle. Therefore, it is easiest to see a rainbow in the afternoon after the rain has cleared up. However, the formation of a rainbow is greatly affected by weather, light and other conditions, so it generally only lasts for a short period of time, and the best viewing and shooting time is even shorter. So when you encounter a rainbow, how can you properly record it and photograph it with quality? 1. Look for rainbows. In addition to the conditions mentioned above, rainbows usually appear in the direction of sunlight, that is, if the sun shines from west to east, rainbows are more likely to appear in the east.

Tutorial on how to turn off the payment sound on WeChat Tutorial on how to turn off the payment sound on WeChat Mar 26, 2024 am 08:30 AM

1. First open WeChat. 2. Click [+] in the upper right corner. 3. Click the QR code to collect payment. 4. Click the three small dots in the upper right corner. 5. Click to close the voice reminder for payment arrival.

What software is photoshopcs5? -photoshopcs5 usage tutorial What software is photoshopcs5? -photoshopcs5 usage tutorial Mar 19, 2024 am 09:04 AM

PhotoshopCS is the abbreviation of Photoshop Creative Suite. It is a software produced by Adobe and is widely used in graphic design and image processing. As a novice learning PS, let me explain to you today what software photoshopcs5 is and how to use photoshopcs5. 1. What software is photoshop cs5? Adobe Photoshop CS5 Extended is ideal for professionals in film, video and multimedia fields, graphic and web designers who use 3D and animation, and professionals in engineering and scientific fields. Render a 3D image and merge it into a 2D composite image. Edit videos easily

iCloud storage full notification: How to fix it iCloud storage full notification: How to fix it Apr 24, 2024 pm 04:43 PM

Does your iPhone show "iCloud Storage Full" whenever you download some files or airdrop something? The free plan of iCloud storage is limited to only 5GB. Therefore, the first thing you should check is the current iCloud storage situation on your phone. If there is still enough storage space and you receive a notification, these solutions will help you troubleshoot. Fix 1 – Delete iCloud Backup Remove the existing version of iCloud backup from your phone settings. Step 1 – Open Settings. Step 2 – You will find your Apple ID at the top of the Settings panel. Click on it to open it. Step 3 – Turn on “iCloud” to open iCloud settings. Step 4 – Down

Experts teach you! The Correct Way to Cut Long Pictures on Huawei Mobile Phones Experts teach you! The Correct Way to Cut Long Pictures on Huawei Mobile Phones Mar 22, 2024 pm 12:21 PM

With the continuous development of smart phones, the functions of mobile phones have become more and more powerful, among which the function of taking long pictures has become one of the important functions used by many users in daily life. Long screenshots can help users save a long web page, conversation record or picture at one time for easy viewing and sharing. Among many mobile phone brands, Huawei mobile phones are also one of the brands highly respected by users, and their function of cropping long pictures is also highly praised. This article will introduce you to the correct method of taking long pictures on Huawei mobile phones, as well as some expert tips to help you make better use of Huawei mobile phones.

See all articles