Recently worked on Networks,Mainly for website creation,AddCMSBackground,Some websites use the original website for reference.,So we need to download some content and fill it in to the background.,Manual operations are difficult,So I wrote a small tool..
Enter the URL to download
Take this example
Http://www.lqpcjx.com/main.asp? Bigproclassid = 2 & smallproclassid = 0 & id = 9
The product list is displayed here.,We need to retrieve the image address.,Generally,We use a regular expression to match the content we want.,However, regular expressions are difficult to write.(At least I do.),So,DownloadSource code,Then write some regular expressions,Test,Is our regular expression correct?,Match the content we want?,
Select,Page Encoding,For example, the page encoding isGb2312,OrUTF-8Of,Select the encoding to prevent garbled characters.,Click to download,The downloaded content will appear in the downloaded content box.,This box is relatively small,If you want to see allCode,Click,Zoom in to view webpage source files,
AFormTo display text in the text box,If you only want to view,Do not modify,Click,Close the button.,If you want to modify the content,Click modify.,In this way, the text in the text box will become the modified content..
Then,You can enter a regular expression.,Click Start match.,Check the matched results.
The matching result is displayed in the matching result.
DisplayForm2This button is displayedForm2ThisFormTo download the content we need
First configuration page,Is to display the desired Download Page,And Content,
You can add addresses in batches by specifying a rule on the page.,This address usesArraylistTo save,No duplicate content,If it is only a single side,Then ignore it.,Wildcard options,Click Add.,The address list is in the URL list.,Displayed,If the list contains addresses that do not need to be downloaded,Selected,Then press the delete key..
The following are regular expression rules.,The add method is the same as the address method..
The address list and regular expression list are ready.,You can click the button to perform matching.,There is an option during processing,Match from the previous result,
The result of this option is that the source content of the second expression is matched from the matching result of the first expression.,
For example,
Http://www.lqpcjx.com/main.asp? PID = 72 & id = 9
We want to match the product images and product introduction on this page,Because this page uses this regular expression., Src = "uploadfile/\ d).jpg"
There will be many results,We only want one,Select the product description.,
Images/index1_32.jpg [\ s] *? \[(Id 1)
My regular expressions are not good.,Content can only be restricted by location.,After we extract the content,Use the following regular expression.Src = "uploadfile/[\ s] + ?. Jpg "(ID 2)Matching results
Then we choose to add Id 1.,Then add the regular expression number 2.
Then select match from the previous result.,Then click Start processing,This button,,After running,Will be saved to this Directory ApplicationProgramCreate a text file by date in the directory,After running the program,The directory is automatically opened.,
The matching content is basically the same.
Http://www.lqpcjx.com/uploadfile/2012917104011924.jpg
Http://www.lqpcjx.com/uploadfile/201292711514802.jpg
Http://www.lqpcjx.com/uploadfile/201210129266632.jpg
This page is used to download a page
On the left is the status bar showing the items downloaded.
What content is downloaded on the right?,
Write the matched address to the file name and address to download it.
The content of the two text boxes is based onID# Download and rename an object,
For example
Product NO. Is
Http://www.lqpcjx.com/main.asp? PID = 70 & id = 5
We can write a regular expression,Matched Product Name,And image address,
Http://www.lqpcjx.com/uploadfile/2012917104011924.jpg
This articleArticleIt is applicable to those who have a certain understanding of regular expressions. Who else do we have programmers? Put the source code below. If you need it, change it. The solution is myregex. sln and vs2008.
/Files/sunbingzibo/aspnet.zip