damilolaolatunji / scraper-tutorial

Web scraper built with Node.js
28 stars 20 forks source link

reddit returns empty array #1

Open marcellocurto opened 4 years ago

marcellocurto commented 4 years ago

Thanks for the great tutorial!

One thing that didn't work was scraping reddit, because they changed the tags of their headlines and wrapped them in another div.

For the code to work at the moment it should probably be something like this: $('a[href*="/r/news/comments"] h3').each(function()

ayoisaiah commented 4 years ago

Awesome @marcellocurto!

Unfortunately I can't make edits to the tutorial, so I will keep this open in case someone else has the same issue.

johnson-jnr commented 4 years ago

Hi, I changed the h2 tag to h3 but still got an empty array. @marcellocurto did you get it to work?

johnson-jnr commented 4 years ago

It's working now, I changed $('a[href*="/r/news/comments"] > h3').each(function() to $('a[href*="/r/news/comments"] h3').each(function() Just remove '>', though I dont know why that is.

cbertrand1978 commented 4 years ago

I can confirm that "$('a[href*="/r/news/comments"] h3').each(function()..." still works.