Example of shell and Python crawler display

Source: Internet
Author: User

1.shell Crawler Examples:

[Email protected] ~]# vim pa.sh #!/bin/bashwww_link=http://www.cnblogs.com/clsn/default.html?page=for i in  {1..8 }doa= ' Curl ${www_link}${i} 2>/dev/null|grep homepage|grep-v "ImageLink" |awk-f "[><\"] "' {print $7" @ "$9} ' > >bb.txt ' #@ the delimiter specified for itself. This line is to get content and content URL doneegrep-v "pager" Bb.txt >ma.txt #将处理后, only content and content URLs left in a file b= ' sed  ' s# # #g " Ma.txt '   #将文件里的空格去掉, because the for loop will take the space of each line as two variables, instead of a variable, this pit took me a long time. For i in $bdo  c= ' echo $i |awk-f @ ' {print $ ' #c = content url  d= ' echo $i |awk-f @ ' {print $} ' #d = Content  echo ' <a hr ef= ' ${c} ' target= ' _blank ' >${d}</a> ' >>cc.txt #cc. txt to generate the text of a label done

Crawler results show: Shanyan crawler results in archived files

Example of shell and Python crawler display

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.