1

I am trying to get data from the Community Tab of a youtube channel, however this does not seem to be supported by the youtube api which I have used so far. I have tried many things including parsing the html but with no luck.

The data I wish to get is:

  1. Number of community posts
  2. Oldest community post date
  3. Newest community post date

Thanks in advance to all who help

2 Answers2

1

To precise user17252227 answer, you better directly parsing the ytInitialData JavaScript variable returned in the HTML to avoid using a slow JavaScript interpreter such as Selenium. As you understand, you will need to use pagination in a similar way as the YouTube Data API v3. Your best luck is to reverse-engineer the community tab by using your Network developer tool tab of your web browser.

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
  • I have already tried that, but it kept giving me errors when I used the .split because [1] was out of range apparently – Daniel Ciantar Aug 21 '22 at 14:52
  • I don't know what `needle` you took for `split` but you may have chosen a wrong one as `curl 'https://www.youtube.com/user/Fairphone/community' | grep 'ytInitialData' | wc -l` returns more than 1. – Benjamin Loison Aug 22 '22 at 10:45
0

I cant really find a way to see the oldest communiy post date or the number of community posts.With webscraping you can only get the firts 9 community posts. So if the Youtubes API doesnt support a feauture that can get you that its gona be hard to find the oldest and the number of posts. Your scrapper will need to manualy load(youtube only loads the firts 9 and then you have to scroll to load the next 9) all of the community posts of a channel count them and find the oldest one.

PanosoikoGr
  • 125
  • 8
  • Ok thanks for the information. Could you by any chance show me how to do that with a simple snippet? – Daniel Ciantar Aug 21 '22 at 12:40
  • I dont have time sorry but i can suggest you to use selenium because you cant do it with soup.And i will give you this link from another post that i think will help you out – PanosoikoGr Aug 21 '22 at 12:54