Web Extractor


You can easily download links and even pages from any web page which will also include their source codes.

/**
*@Auther  :Nishant Soni
*@Project :Web Extractor
*@Date    :17th July, 2011
*/
 
#include <stdio.h>
#include <string.h>
 
FILE *f, *fp;
 
extract(char const *input, char const *output){
 
f = fopen(input, \"r\");
fp = fopen(output, \"w\");
 
fseek(f, 0L, SEEK_END);
int size = ftell(f);
 
 
fseek(f, 0L, SEEK_SET);
char name[size];
int j;
char c;
for(j = 0; j < size; j++){
name[j] = getc(f);
}
 
int i;
for(i = 0; i < size; i++){
if(name[i] == \'h\'|| name[i] ==\'H\'){
if(name[i+1] ==\'r\'|| name[i+1] ==\'R\'){
if(name[i+2] == \'e\'|| name[i+2] ==\'E\'){
if(name[i+3] ==\'f\'|| name[i+3] ==\'F\'){
i += 6;
while(name[i] != \'\"\' && name[i] !=\'\\\'\'){
fputc(name[i],fp);
i++;
}
fputc(\'\\n\',fp);
}
}
}
}
i++;
}
close(f);
close(fp);
}
int main(int argc, char **argv){
 
if(argc <= 2){
printf(\"USAGE:\\n\\n\");
printf(\"url [input file] [link file]\\n\\n\");
return(0);
}
 
printf(\"Extracting Links...\\n\");
extract(argv[1], argv[2]);
printf(\"Links are extracted!\\n\");
 
return(1);
}

Leave a Reply