shahin
Active Member
I've written some code using vba to get all the movie names from a specific webpage out of a torrent site. However, pressing "F8" I could find out that the code works well and prints the results until it hits the last result from that page. As soon as it reaches the last name to parse, the program crashes. I did several times and suffered the same consequences. If vba doesn't support this css selector method then how could I collect results before the last one? Is there any reference to add in the library or something else before execution? It would be awesome if it is possible to scrape webpages using css selector. Any help on this will be vastly appreciated. here is the code I have written:
Code:
Sub Torrent_data()
Dim http As New XMLHTTP60, html As New HTMLDocument
Dim movie_name As Object
With http
.Open "GET", "https://www.yify-torrent.org/search/1080p/", False
.send
html.body.innerHTML = .responseText
End With
For Each movie_name In html.querySelectorAll("div.mv h3 a")
x = x + 1
Cells(x, 1) = movie_name.innerText
Next movie_name
End Sub