[]
վ=GOOGLEͼ
վַ=http://books.google.cn/
=books.google.nl;books.google.com;books.google.se;books.google.ru;books.google.de;books.google.co.uk;books.google.co.jp;books.google.com.tw;books.google.com.hk;books.google.es;books.google.fr;books.google.be;books.google.co.kr;books.google.co.nz;books.google.dk;books.google.gr;books.google.hu;books.google.co.in;books.google.com.mx;books.google.co.za;books.google.at;books.google.com.bd;books.google.az;books.google.bg;books.google.com.by;books.google.ch;books.google.com.co;books.google.com.cu;books.google.fi;books.google.kz;books.google.mn;books.google.com.my;books.google.com.sg;books.google.sk
=С˵
=UTF-8
ʹIE=
ݽȡʼ1=_OC_Run({"page
ݽȡ1=}],"prefix"
Ҫ滻ַ=","$$$$$&$$$$$,"$$$$$&$$$$$":"$$$$$=$$$$$":$$$$$=$$$$$pid=$$$$$pg=
ץȡ=1
½ڵַʶ=id=\S+
ȡбִнű=
=UTF-8
POST=
ַ=http://books.google.cn/books?rview=1&q=$key&as_brr=1
ַ_=http://books.google.cn/books?rview=1&q=$key&as_brr=1
бʼ=ͼ</b>
б=id=navbar class=n>
б=<a\s+href="(#ַ,.*?)"[\s\S]*?<img\s+border[\s\S]*?alt="(#,.*?)"
ҳַ={1,href=\"([^\"]*?)\"><img src=\/nav_next}

sort=10
{script}
const dftdomain = 'http://books.google.com/';
var alldomain	: array of string;
var rnddomain	: string;
var purl	: string;
var cookie	: string;

//ȡһ(Լĺ)
function getrnddomain:string;
begin
	result := 'http://'+alldomain[Int((length(alldomain)-1)*Random)]+'/';
end;

//ͼƬǰ
function MyStartDownImg(var content,imgurl,imgfile,imgtext:string):boolean;
const 
	maxrepeat = 10;
var
	nowrepeat	: integer;
	jsurl 		: string;
	downstr		: string;
	ext			: string;
begin
	result	:= false;
	rnddomain := getrnddomain;
	//һGOOGLEͼJSONҳַ,ʵͼƬַJSON
	jsurl	:= replace(imgurl, '&img=1&zoom=3', '&jscmd=click3');
	jsurl	:= replace(jsurl, dftdomain, rnddomain);
	lg('ȡʵַУ'+jsurl);
	nowrepeat	:= 1;
	//
	repeat
		downstr	:= Down(jsurl, 'utf-8');
		if downstr='' then
		begin
			LG('GOOGLEʵַʧܣ.');
			inc(nowrepeat);
		end
		else break;
	until nowrepeat>maxrepeat;
	if downstr='' then
	begin
		LG('GOOGLEʵַʧܣֹ.');
		stop;
	end
	else begin
		//ȡʵĵַ
		imgurl	:= getmidstr(downstr, '","src":"','","flags":');
		//滻ַ
		imgurl	:= replace(imgurl, '\x26', '&');
		//ַֹIP
		imgurl	:= replace(imgurl, dftdomain, rnddomain);
		if imgurl = '' then
		begin
			LG('ͼƬ:'+imgfile+'Զ̲ڣ');
			result := true;
			imgtext:= '';
			exit;
		end;
		repeat
			//ϴεĻ棬±COOKIEЧ
			CLEARDOWNCACHE;
			_GET.FROM		:= '';
			_GET.REFERER	:= '';
			_GET.COOKIE		:= cookie;
			//HEADһµַȡС
			Down(imgurl, '', 'head');
			//жϷصĴ
			if _GET.RESPONSECODE=200 then
			begin
				LG('ѯԶļСɹ.');
				break;
			end
			else begin
				LG('²ѯԶļС.');
				inc(nowrepeat);
			end;
		until nowrepeat>maxrepeat;
		
		//ݻȡͷϢĺ׺
		//ʱֻ֧֣JPGBMPPNGGIF
		Ext := LowerCase(copy(_Get.ContentType, Pos('/', _Get.ContentType)+1, length(_Get.ContentType)));
		if pos(';',Ext)>0 then Ext := copy(Ext,1,pos(';',Ext)-1);
		if(Ext='jpeg')OR(Ext='pjpeg')OR(Ext='jpg')then Ext := '.jpg'
		else if(Ext='bmp')then Ext := '.bmp'
		else if(Ext='png')then Ext := '.png'
		else if(Ext='gif')then Ext := '.gif';
		//Ѻ׺滻
		imgfile := replace(imgfile, LowerCase(GetFileExt(imgfile)), Ext);
		//ҪļǷ,˾ͲҪˡ
		if fileexists(_data.savedir+imgfile) then
		begin
			//鱾شСԶ̴СǷͬ
			if getfilesize(_data.savedir+imgfile)=_GET.ContentLength then
			begin
				lg('ѾڴСͬͼƬĿ¼');
				result := true;
			end;
		end;
	end;
end;

//½ݷǰ
procedure MybeforeSplitContent(var content:string;nowurl:string;repeatindex:integer);
var
	overstr : string;
begin
	//ȡַ
	//1ֿ
	purl	:= getmidstr(content, 'background-image:url("', '"); width:');
	//2ֿ
	if purl = '' then 
	begin
		overstr := copy(content, pos('","src":"',content), length(content));
		purl := copy(overstr, 0, pos('"',overstr));
	end;
	
	//滻
	purl	:= dftdomain+copy(purl, pos('/books?', purl), length(purl))+'&';
end;

//½ݷ
procedure myAfterSplitContent(var content:string;repeatindex:integer);
var
	body : string;
	downstr : string;
begin
	//Ϊ1ʱ
	if repeatindex=1 then
	begin
		//õGOOGLEͷset-cookieõȫCOOKIE
		if _GET.cookie<>'' then
		begin
			cookie			:= _GET.cookie;
			//lg(cookie);
		end;
		//ȫIMGǩIMGǩͼƬ.
		body	:= content;
		body	:= replace(body, '=[{"', '<img src="'+purl);
		body	:= replace(body, '"},{"', '"><img src="'+purl);
		body	:= replace(body, '},{"', '"><img src="'+purl);
		content	:= body+'">';
	end;
end;
var
	ki : integer;
	fbody : string;
	Matchs,subMatch : variant;
begin
	{ki := 1;
	while ki<68 do
	begin
		down('http://'+inttostr(ki)+'.duote.com/txtgetnovel.zip','','head');
		lg(inttostr(ki)+','+_GET.ContentLength);inc(ki);
	end;}
	
	//ȡ
	alldomain := Split(';', F(''));
end.
{/script}
