Flash advanced application Knowledge search engine keyword Location Code

Source: Internet
Author: User
Tags eval join split urlencode
Advanced | keywords | search engine//make Ant-felling yifa2008@hotmail.com can be modified arbitrarily
Last Updated on 2005-11-9
2005-11-9 will Yisou adjustment for Yahoo China Search (Yahoo China strategy change, Yisou curtain Call)
2005-9-24 revision, including Baidu promotion ranking position
Fscommand ("Allowscale", false);
var keyw_s:string;//original keyword
var keyw:array=["", "", "" "];//search engine three items in turn represent Baidu Google Yahoo
var url:string;//url
var searchstop:array=[true,true,true];//search Termination Flag
var searche:array=[true,true,true];//search engine Three entries in turn represent Baidu Google Yahoo
var inpage:number;//search Scope
var nowpage:array=[1,1,1];//current Search Page Three entries in turn represent Baidu Google Yahoo
var ingsearch:array=[false,false,false];//current Search Page Three entries in turn represent Baidu Google Yahoo
var searchlistener:object = new Object ()//Start Search button
Searchlistener.click=keysstart;
Keysstart_b.addeventlistener ("click", Searchlistener);

var stoplistener:object = new Object ()//Stop button
Stoplistener.click=function () {
Searchstop=[false,false,false];
Keysstart_b.addeventlistener ("click", Searchlistener);
Keysstart_b.enabled=true;
}
Keysstop_b.addeventlistener ("click", Stoplistener);

--------------------------------Select search Engine-------------------------//
var checklist:object = new Object ();
Checklist.click=function (SE) {//Select search engine
var nowse=number (RPS (se.target._name, "se", ""));
searche[nowse-1]=se.target.selected;
}
Se1.addeventlistener ("click", Checklist);
Se2.addeventlistener ("click", Checklist);
Se3.addeventlistener ("click", Checklist);
--------------------------------Select search Engine-------------------------//

function Backall () {//Archive all data
Keyw=["", "", "" "];
Searchstop=[true,true,true];
nowpage=[1,1,1];
Baidulink_b._visible=false;
Googlelink_b._visible=false;
Yahoolink_b._visible=false;
Baidu_i.text= "";
Google_i.text= "";
Yahoo_i.text= "";
}
Backall ();
function Keysstart () {//Start search
if (keyw_i.text== "or keyw_i.text== keyword required") {
keyw_i.text= "Need keywords";
return false;
}
if (url_i.text== "" or url_i.text== "requires URL") {
url_i.text= "Need url";
return false;
}
if (Searche.join (",") = = "False,false,false") {
return false;
}

Keysstart_b.removeeventlistener ("click", Searchlistener);
Keysstart_b.enabled=false;
Keysstart_b.label= "is inquiring";

Backall ();

keyw_s=keyw_i.text;//Save the original keyword
Inpage=inpage_i.value;
Url=url_i.text;
Url=url.tolowercase ();

System.usecodepage = true;

if (Searche[0]) {//baidu
Keyw[0]=escape (keyw_s);
Keysbaidu ();
Ingsearch[0]=true;
}
if (Searche[2]) {//yahoo
System.usecodepage = false;
Keyw[2]=escape (keyw_s);
System.usecodepage = true;
Keysyahoo ();
Ingsearch[2]=true;
}
if (Searche[1]) {//google
Keyw[1]=escape (keyw_s);
Keysgoogle ();
Ingsearch[1]=true;
}
}

function Keysyahoo () {//find keyword ranking in yahoo
if (!searchstop[2] | | Number (nowpage[2]) >inpage) {//stop if it is terminated or exceeds the search scope
("Yahoo", nowpage[2],2,2);
return false;
}
("Yahoo", nowpage[2],1);
var mydata=new loadvars ();
var searchurl:string= "http://cn.search.yahoo.com/search?p=" +keyw[2]+ "&ei=utf-8&b=" + ((nowpage[2]-1) *10+1 );
Mydata.load (Searchurl);

Mydata.ondata=function (SRC) {
var tmpa=src.split (URL);
if (tmpa.length>1) {
var mys=tmpa[0];
var Mys=rps (Mys, ">[promotion]</a>", "snapshot of the Web");
var od= ((nowpage[2]-1) *10) + (Mys.split ("Web Snapshot"). Length;
System.usecodepage = false;
var spkeyw:string=escape (keyw_s);//Generate UrlEncode encoding for keywords in the connection
System.usecodepage = true;
Resrep ("Yahoo", RPS (SEARCHURL,KEYW[2],SPKEYW), od,2);
}else{
nowpage[2]++;
Keysyahoo ();
}
}
}
function Keysbaidu () {//Find keyword ranking in baiduu
if (!searchstop[0] | | Number (Nowpage[0]) >inpage) {//stop if it is terminated or exceeds the search scope
("Baidu", nowpage[0],2,0);
return false;
}
("Baidu", nowpage[0],1);
var mydata=new loadvars ();
var searchurl:string= "http://www.baidu.com/s?lm=0&si=&rn=10&ie=gb2312&ct=0&cl=3&wd=" + keyw[0]+ "&pn=" + ((nowpage[0]-1) *10);
Mydata.load (Searchurl);
Mydata.ondata=function (SRC) {
var tmpa=src.split (URL);
if (tmpa.length>1) {
var mys=tmpa[0];
var Mys=rps (Mys, "> Promotion </a>", "Baidu snapshot");
var od= ((nowpage[0]-1) *10) + (Mys.split ("Baidu snapshot"). Length;
Resrep ("Baidu", searchurl,od,0);
}else{
nowpage[0]++;
Keysbaidu ();
}
}
}

function Keysgoogle () {//find keyword ranking in google
if (!searchstop[1] | | Number (nowpage[1]) >inpage) {//stop if it is terminated or exceeds the search scope
("Google", nowpage[1],2,1);
return false;
}
("Google", nowpage[1],1);
var mydata=new loadvars ();
var searchurl:string= "http://www.google.com/search?q=" +keyw[1]+ "&hl=zh-cn&lr=&oe=gb2312&inlang= Zh-cn&start= "+ ((nowpage[1]-1) *10);
Mydata.load (Searchurl);
Mydata.ondata=function (SRC) {
var tmpa=src.split (URL);
if (tmpa.length>1) {
var mys=tmpa[0];
var od= ((nowpage[1]-1) *10) + (Mys.split ("Similar Web page"). Length;
System.usecodepage = false;
var spkeyw:string=escape (keyw_s);//Generate UrlEncode encoding for keywords in the connection
System.usecodepage = true;
Resrep ("Google", RPS (SEARCHURL,KEYW[1],SPKEYW), od,1);
}else{
nowpage[1]++;
Keysgoogle ();
}
}
}
function Se,np,op,seid {//op state 1 normal 2 stop
Switch (OP) {
Case 1:
Eval (se+ "_i"). text= "is querying page" +np+ ";
Break
Case 2:
Eval (se+ "_i"). text= "stopped in front" + (np-1) + "page not Found";
Ingsearch[seid]=false;
if (Ingsearch.join (",") = = "False,false,false") {
Backkeysstart ();
}
Break
Default
Eval (se+ "_i"). text= "Abnormal error Please try again";
}
}
function Resrep (Se,surl,od,seid) {//FINAL results Report
Eval (se+ "_i"). text=url+ "Rank" +od in the search results of the keyword "+keyw_s+";
Eval (se+ "Link_b"). _visible=true;
Eval (se+ "Link_b"). Onrelease=function () {
GetURL (sURL, "_blank");
}
Ingsearch[seid]=false;
if (Ingsearch.join (",") = = "False,false,false") {
Backkeysstart ();
}
}
function Backkeysstart () {//Search button re available
Keysstart_b.addeventlistener ("click", Searchlistener);
Keysstart_b.enabled=true;
Keysstart_b.label= "Start Query";
}
function RPS (txt,o,n) {//String substitution functions
var tmpa:array=txt.split (o);
var newstring=tmpa.join (n);
return newstring;
}

Mylink.onrelease=function () {
GetURL ("http://www.lcdera.com/keywords/", "_blank");
}
Baidu_link.onrelease=function () {
GetURL ("http://www.baidu.com", "_blank");
}
Google_link.onrelease=function () {
GetURL ("http://www.google.com", "_blank");
}
Yahoo_link.onrelease=function () {
GetURL ("http://cn.search.yahoo.com", "_blank");
}

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.