web scraping - Can't use querySelector in a proper way in vba -
i've written code using vba movie names specific webpage out of torrent site. however, pressing "f8" find out code works , prints results until hits last result page. reaches last name parse, program crashes. did several times , suffered same consequences. if vba doesn't support css selector method how collect results before last one? there reference add in library or else before execution? on vastly appreciated.
here code have written:
sub torrent_data() dim http new xmlhttp60, html new htmldocument dim movie_name object, movie object http .open "get", "https://www.yify-torrent.org/search/1080p/", false .send html.body.innerhtml = .responsetext end set movie_name = html.queryselectorall("div.mv h3 a") each movie in movie_name x = x + 1: cells(x, 1) = movie.innertext next movie end sub
try this:
sub torrent_data() dim http new xmlhttp60, html new htmldocument, x long http .open "get", "https://www.yify-torrent.org/search/1080p/", false .send html.body.innerhtml = .responsetext end x = x + 1 on error resume next cells(x, 1) = html.queryselectorall("div.mv h3 a")(x - 1).innertext loop until err.number = 91 end sub
Comments
Post a Comment