Jump to content




[Youtube] Subscribers counter [solved]


5 replies to this topic

#1 LabyStudio

  • Members
  • 39 posts

Posted 13 July 2013 - 08:33 AM

[Youtube] Subscribers counter

solved.

-- code by Bubba
local page = http.get("http://www.youtube.com/channel/NAME") --#Some channel
local text = page.readAll()
print("Subscribers -> "..text:match([[subscribed"%s->([^<]*)]]))


#2 Zudo

  • Members
  • 800 posts
  • LocationUK

Posted 13 July 2013 - 09:40 AM

Would this help?
https://developers.google.com/youtube/

#3 LabyStudio

  • Members
  • 39 posts

Posted 13 July 2013 - 09:47 AM

View PostZudoHackz, on 13 July 2013 - 09:40 AM, said:


yes, but I don't understand how I let it show only the subscribers

#4 Grim Reaper

  • Members
  • 503 posts
  • LocationSeattle, WA

Posted 13 July 2013 - 04:45 PM

Apparently, you'll need to register your application with Google if you want to use their client-side API for interaction with your YouTube account. However, you could probably just download the page-source for a YouTube account and parse out the subscription count.

#5 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

Posted 13 July 2013 - 10:15 PM

It's pretty simple if all you need is the subscribed amount. If you take a look in the source code of the page, you'll see something like this:
<span class="yt-subscription-button-subscriber-count-branded-horizontal subscribed">36</span>

So get the page text and run a simple regex match on it:
local page = http.get("http://www.youtube.com/channel/UC83CJDRvam3_3VKK2L52x9g") --#Some channel
local text = page.readAll()
print("Subscribers -> "..text:match([[subscribed"%s->([^<]*)]]))

Which will print out: "Subscribers -> 36"

#6 LabyStudio

  • Members
  • 39 posts

Posted 15 July 2013 - 09:27 AM

View PostBubba, on 13 July 2013 - 10:15 PM, said:

It's pretty simple if all you need is the subscribed amount. If you take a look in the source code of the page, you'll see something like this:
<span class="yt-subscription-button-subscriber-count-branded-horizontal subscribed">36</span>

So get the page text and run a simple regex match on it:
local page = http.get("http://www.youtube.com/channel/UC83CJDRvam3_3VKK2L52x9g") --#Some channel
local text = page.readAll()
print("Subscribers -> "..text:match([[subscribed"%s->([^<]*)]]))

Which will print out: "Subscribers -> 36"

thank you;)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users