Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get data & media from webpage

Status
Not open for further replies.

KiaruB

Technical User
Apr 5, 2005
35
DE
Hello,

Im trying to automate a search on the Amazon webpage, looking for album covers and data.

I can link to the webpage and automate the search but breaking my head on getting the pictures of the album covers out of the searchresults

anyone any idea's ?

Thx.
 
Are you quite sure you are not infringing copyright?
 
Not really
most audio file managers you can find on the web have a function that links to amazon or other webpages to find album cover art, lyrics, album data and so on
no copyright involved
greets
 
KiaruB,
Here is one direction, coded in Excel 2000 SP2 using IE 7 on a WinXP box.
Code:
Option Explicit

Private Declare Function URLDownloadToFileA Lib "urlmon" _
  (ByVal pCaller As Long, ByVal szURL As String, ByVal _
  szFileName As String, ByVal dwReserved As Long, _
  ByVal lpfnCB As Long) As Long

Public Sub GetPictures()
  Dim objIE As Object
  Dim objCells As Object, objCell As Object
  Dim objImgs As Object, objImg As Object
  
  Set objIE = CreateObject("InternetExplorer.Application")
  With objIE
    .AddressBar = False
    .StatusBar = False
    .MenuBar = False
    .Toolbar = 0
    .Visible = True
    .Navigate "[URL unfurl="true"]http://www.amazon.com/s/ref=nb_ss_gw?"[/URL] & _
      "url=search-alias%3Daps&field-keywords=sevendust"
  End With
  While objIE.Busy
    'Do Nothing
  Wend
  While objIE.Document.ReadyState <> "complete"
    'AgaIn Do Nothing
  Wend
  
  Set objCells = objIE.Document.All.Tags("TD")
  For Each objCell In objCells
    If objCell.className = "imageColumn" Then
      Set objImgs = objCell.All.Tags("img")
      For Each objImg In objImgs
        URLDownloadToFileA 0, objImg.src, "C:\" & objImg.alt & ".jpg", 0, 0
        Stop
      Next objImg
    End If
  Next objCell
  
  Set objImg = Nothing
  Set objImgs = Nothing
  Set objCell = Nothing
  Set objCells = Nothing
  objIE.Quit
  Set objIE = Nothing
End Sub

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top