bookfind 通過(guò)ISBN序號(hào)獲取圖書連接的書名與作者的vbs代碼
更新時(shí)間:2011年12月26日 00:02:20 作者:
bookfind 通過(guò)ISBN序號(hào)獲取圖書連接的書名與作者的vbs代碼,類似小偷程序,通過(guò)正則匹配,雖然現(xiàn)在已經(jīng)無(wú)法使用,但代碼不錯(cuò),原理都有
核心代碼:
If WScript.Arguments.UnNamed.Count <> 1 Then Syntax
If WScript.Arguments.Named.Count > 1 Then Syntax
blnTd = False
If WScript.Arguments.Named.Count = 1 Then
If UCase( WScript.Arguments.Named( 0 ) ) = "/TD" Then
blnTd = True
Else
Syntax
End If
End If
strISBN = WScript.Arguments.UnNamed( 0 )
strPgTitle = TitleFromHTML( "http://www.amazon.com/gp/product/" & strISBN & "/" )
strPattern = "Amazon.com: (.*): Books: (.*)$"
strTitle = RegExpVal( strPattern, strPgTitle, 0 )
strAuthor = RegExpVal( strPattern, strPgTitle, 1 )
If blnTd Then
strMsg = strISBN & vbTab & strTitle & vbTab & strAuthor & vbCrLf
Else
strMsg = vbCrLf & "Title : " & strTitle _
& vbCrLf & "Author : " & strAuthor _
& vbCrLf & "ISBN : " & strISBN
End If
WScript.Echo strMsg
Function RegExpVal( strPattern, strString, idx )
On Error Resume Next
Dim regEx, Match, Matches, RetStr
Set regEx = New RegExp
regEx.Pattern = strPattern
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute( strString )
RegExpVal = Matches( 0 ).SubMatches( idx )
End Function
Function TitleFromHTML( strURL )
Set ie = CreateObject( "InternetExplorer.Application" )
ie.Navigate strURL
Do Until ie.ReadyState = 4
WScript.Sleep 10
Loop
TitleFromHTML = ie.Document.Title
ie.Quit
End Function
Sub Syntax
strMsg = strMsg & vbCrLf & "BookFind.vbs, Version 1.11" & vbCrLf _
& "Display book title and author name for the specified ISBN number." & vbCrLf & vbCrLf _
& "Usage: CSCRIPT //NOLOGO BOOKFIND.VBS isbn [ /TD ]" & vbCrLf & vbCrLf _
& "Where: ""isbn"" is the ISBN (or ASIN) of the book to search for" & vbCrLf _
& " /TD changes the output format to tab delimited" & vbCrLf & vbCrLf _
& "Note: This script uses Amazon's web site to look up author and title." & vbCrLf _
& " To be precise, the data is extracted from the title of the page" & vbCrLf _
& " with URL http://www.amazon.com/gp/product/ followed by the ISBN." & vbCrLf _
& " That means this script will fail when Amazon changes the URLs." & vbCrLf & vbCrLf _
& "Written by Rob van der Woude" & vbCrLf _
& "http://www.robvanderwoude.com"
Wscript.Echo( strMsg )
Wscript.Quit( 1 )
End Sub
使用方法:
CSCRIPT //NOLOGO BOOKFIND.VBS isbn [ /TD ]
Where: "isbn" is the ISBN (or ASIN) of the book to search for
/TD changes the output format to tab delimited
Note: This script uses Amazon's web site to look up author and title.
To be precise, the data is extracted from the title of the page
with URL http://www.amazon.com/gp/product/ followed by the ISBN.
That means this script will fail when Amazon changes the URLs.
復(fù)制代碼 代碼如下:
If WScript.Arguments.UnNamed.Count <> 1 Then Syntax
If WScript.Arguments.Named.Count > 1 Then Syntax
blnTd = False
If WScript.Arguments.Named.Count = 1 Then
If UCase( WScript.Arguments.Named( 0 ) ) = "/TD" Then
blnTd = True
Else
Syntax
End If
End If
strISBN = WScript.Arguments.UnNamed( 0 )
strPgTitle = TitleFromHTML( "http://www.amazon.com/gp/product/" & strISBN & "/" )
strPattern = "Amazon.com: (.*): Books: (.*)$"
strTitle = RegExpVal( strPattern, strPgTitle, 0 )
strAuthor = RegExpVal( strPattern, strPgTitle, 1 )
If blnTd Then
strMsg = strISBN & vbTab & strTitle & vbTab & strAuthor & vbCrLf
Else
strMsg = vbCrLf & "Title : " & strTitle _
& vbCrLf & "Author : " & strAuthor _
& vbCrLf & "ISBN : " & strISBN
End If
WScript.Echo strMsg
Function RegExpVal( strPattern, strString, idx )
On Error Resume Next
Dim regEx, Match, Matches, RetStr
Set regEx = New RegExp
regEx.Pattern = strPattern
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute( strString )
RegExpVal = Matches( 0 ).SubMatches( idx )
End Function
Function TitleFromHTML( strURL )
Set ie = CreateObject( "InternetExplorer.Application" )
ie.Navigate strURL
Do Until ie.ReadyState = 4
WScript.Sleep 10
Loop
TitleFromHTML = ie.Document.Title
ie.Quit
End Function
Sub Syntax
strMsg = strMsg & vbCrLf & "BookFind.vbs, Version 1.11" & vbCrLf _
& "Display book title and author name for the specified ISBN number." & vbCrLf & vbCrLf _
& "Usage: CSCRIPT //NOLOGO BOOKFIND.VBS isbn [ /TD ]" & vbCrLf & vbCrLf _
& "Where: ""isbn"" is the ISBN (or ASIN) of the book to search for" & vbCrLf _
& " /TD changes the output format to tab delimited" & vbCrLf & vbCrLf _
& "Note: This script uses Amazon's web site to look up author and title." & vbCrLf _
& " To be precise, the data is extracted from the title of the page" & vbCrLf _
& " with URL http://www.amazon.com/gp/product/ followed by the ISBN." & vbCrLf _
& " That means this script will fail when Amazon changes the URLs." & vbCrLf & vbCrLf _
& "Written by Rob van der Woude" & vbCrLf _
& "http://www.robvanderwoude.com"
Wscript.Echo( strMsg )
Wscript.Quit( 1 )
End Sub
使用方法:
CSCRIPT //NOLOGO BOOKFIND.VBS isbn [ /TD ]
Where: "isbn" is the ISBN (or ASIN) of the book to search for
/TD changes the output format to tab delimited
Note: This script uses Amazon's web site to look up author and title.
To be precise, the data is extracted from the title of the page
with URL http://www.amazon.com/gp/product/ followed by the ISBN.
That means this script will fail when Amazon changes the URLs.
您可能感興趣的文章:
- javascript字符串與數(shù)組轉(zhuǎn)換匯總
- Javascript進(jìn)制轉(zhuǎn)換實(shí)例分析
- Javascript實(shí)現(xiàn)顏色rgb與16進(jìn)制轉(zhuǎn)換的方法
- JavaScript轉(zhuǎn)換二進(jìn)制編碼為ASCII碼的方法
- JavaScript將字符串轉(zhuǎn)換為整數(shù)的方法
- php根據(jù)isbn書號(hào)查詢amazon網(wǎng)站上的圖書信息的示例
- PHP校驗(yàn)ISBN碼的函數(shù)代碼
- JavaScript實(shí)現(xiàn)將UPC轉(zhuǎn)換成ISBN的方法
相關(guān)文章
VBS教程:VBScript 基礎(chǔ)-VBScript 運(yùn)算符
VBS教程:VBScript 基礎(chǔ)-VBScript 運(yùn)算符...2006-11-11可以得到當(dāng)前系統(tǒng)信息的腳本sysinfo.vbs
可以得到當(dāng)前系統(tǒng)信息的腳本sysinfo.vbs...2007-02-02一些經(jīng)典的主要用戶黑客的vbs腳本結(jié)合echo的dos下實(shí)現(xiàn)
一些經(jīng)典的主要用戶黑客的vbs腳本結(jié)合echo的dos下實(shí)現(xiàn)...2007-02-02把任意文件轉(zhuǎn)成vbs文件的file2vbs的vbs代碼
文章作者:xiaolu [BST] 信息來(lái)源:邪惡八進(jìn)制信息安全團(tuán)隊(duì)(www.eviloctal.com) 這個(gè)不是exe2vbs 所有類型的文件都可以轉(zhuǎn)化的 不過(guò)限于string的大小 文件不能太大 我測(cè)試過(guò)3m的文件是可以的2008-05-05VBS教程:VBscript語(yǔ)句-Option Explicit 語(yǔ)句
VBS教程:VBscript語(yǔ)句-Option Explicit 語(yǔ)句...2006-11-11