Showing posts with label .Document.getElementsByTagName. Show all posts
Showing posts with label .Document.getElementsByTagName. Show all posts

Friday, June 15, 2007

Keyword search trick

Searching your Blogs made easy...

A two function javascript that allows your visitors to query the web with any keywords from your page.

The first function checks if the item you double clicked on the document is a text then it passes it to the second function that appends the text value to your specified query string.

You can opt for the result to be displayed on the same page by using:

document.getElementById("<$id$>").innerHtml = ""

Or Pop up a new window:

window.open("<$variables$>")

Or redirect the page:

this.document.location=("" + "")

Code Snippet:

  1. function searchmySite() {
  2. if (navigator.appName!='Microsoft Internet Explorer') {
  3. var mykeywords = document.getSelection();
  4. omg(mykeywords);
  5. }
  6. else {
  7. var mykeywords = document.selection.createRange();
  8. if(document.selection.type == 'Text' && mykeywords .text>'') {
  9. document.selection.empty();
  10. omg(mykeywords.text);}
  11. }
  12. function omg(mykeywords ) {
  13. var searchStr = "<Put your search string here>"
  14. while (mykeywords.substr(mykeywords.length-1,1)==' ')
  15. mykeywords=mykeywords.substr(0,mykeywords.length-1)
  16. while (mykeywords.substr(0,1)==' ')
  17. mykeywords=mykeywords.substr(1)
  18. if (mykeywords) document.location=(searchStr + mykeywords);
  19. }
  20. }
  21. document.ondblclick=searchmySite


If at first you fail, call it version 1.0

Monday, June 11, 2007

Viral detection on multiple page loads

Aside from having too much page loads detected as being viral, too much query from a single point of origin is also detected as viral... now this is the time that when the search results will prompt you for message that this query format is detected as virus and will ask you to key in the confirmation code to confirm that it was a valid search query.

Anyway, since ie will just crash your machine when performing too much page load and queries, I have written another scriptlet that utilizes MSXML2.ServerXMLHTTP.4.0 instead, so no api calls are made to unreliable but wonderfully obedient ie.

Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP.4.0")

'::::: Set your proxy here, comment it if not required


xmlhttp.setProxy 2,"10.1.1.1:8080"

'::::: Open the url using http Get

xmlhttp.open "GET", purl, false

You may use the following as part of your query URL:

InURL:Index.Of?mp3 InText:Index.Of?mp3 InTitle:Index.Of?mp3 InURL:Top Keywords InText:Top Keywords InTitle:Top Keywords InURL:scripts InText:scripts InTitle:scripts InURL:niche InText:niche InTitle:niche InURL:adsense InText:adsense InTitle:adsense InURL:income InText:income InTitle:income InURL:3gp InText:3gp InTitle:3gp InURL:hotel InText:hotel InTitle:hotel InURL:travel InText:travel InTitle:travel InURL:medicine InText:medicine InTitle:medicine InURL:new InText:new InTitle:new InURL:best InText:best InTitle:best InURL:rare InText:rare InTitle:rare InURL:free InText:free InTitle:free InURL:finance InText:finance InTitle:finance InURL:movie InText:movie InTitle:movie InURL:download InText:download InTitle:download InURL:source InText:source InTitle:source InURL:game InText:game InTitle:game InURL:music InText:music InTitle:music InURL:audio InText:audio InTitle:audio InURL:film InText:film InTitle:film InURL:digital InText:digital InTitle:digital InURL:flight InText:flight InTitle:flight InURL:school


':::::: Make sure you define your Browser Agent or else queries will not be allowed and will prompt you for blocks of code that you might need to submit to rectify the malformed query.

xmlhttp.setRequestHeader "User-Agent","Microsoft Internet Explorer"


xmlhttp.send()


':::::: You can do anything with the search results, follow the links, blah
WScript.Echo xmlhttp.responseText

set xmlhttp = nothing


If at first you fail, call it version 1.0

Why Click it, If you can script it?

While 10,000 ecpm can earn you $0.40, one wonders how much it takes to actually earn...

A sequel to my previous post on my recent fascination on ecpm, page loads doesn't mean much if either the page loads are in millisecond and no links in the pages are clicked or the search option was utilized...

Adding an extra function allows the page loads to have a little extra sense as not only page loads will be peformed, but hey... even the search option is populated with a query string (maybe from an array, etc...)... and an added trick to perform the click to actually perform the query...

To fill up the input for the search utility:
.Document.All.tags("INPUT")("q").Value = searchKey

To Click the search button:
Set sButt = .Document.getElementsByTagName("INPUT")
For Each Butt in
sButt
If LCase(Butt.getAttribute("value")) = "search" Then
Butt.Click
Exit For
End If
Next

If this makes sense and actually is acceptable, why not click on all the links in the result page to add up to your ecpm queries...

Set xLinx = .Document.getElementsByTagName("a")
For Each Linx In xLinx
Linx.Click
Next

Note: Make sure that your site setting is to load the results in the same page, rather than popping up new windows... or else you will flood your screen with tons of ie windows... hahaha... (this, even if .visible=0)

A terminate process will help in getting rid of all the unwanted window popups:

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'Iexplore.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Note: Do this after each page finishes loading after the click.

A draw back is that all your cookies and such are tracked, hence after numerous reloads and queries it might be detected as a viral activity, solution... clear your tracks...

First, get you cache path from your registry:
CachePath = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths\Directory")

Then parse through the folders to delete all cache:
Set rootFolder = fso.GetFolder(CachePath)
Set subFolders = rootFolder.SubFolders
For Each folder in subFolders
fso.DeleteFolder(folder)
Next

You may reuse the same to delete the remaining files in the rootfolder. Just replace .SubFolders to .Files.

There you go...

As easy as it looks like and as cool as it may seem, this will not guarantee that you will actually earn anything based on pageloads and queries... ecpm is not as easily attainable although your site is now generating billions of pageloads\month...

And knowing how M$oft Internet Explorer sucks bigtime, you know that it will crash alot if you execute this like 10,000 times????

Anyway, I use Opera and Firefox 50/50... I only use IE to test my scripts to see how long it will take to crash it...

Good luck!

If your first attempt fails, call it version 1.0