Airkek / Youtube-Viewers

simple C# Youtube livestream botter
MIT License
211 stars 108 forks source link

You must use api/stats/playback before watchtime #128

Closed IceyTroll closed 3 years ago

IceyTroll commented 3 years ago

So if anyone is wondering you need to implement a request to https://www.youtube.com/api/stats/playback which will initialize the viewer so it is counted towards live viewer. Then you must keep the connection through https://www.youtube.com/api/stats/watchtime.

Will answer any questions you have :)

Here is some RE code from YT to make it easier: ` public static int[] GenerateRT() { int Zk = (int)-Math.Floor(10 new Random().NextDouble()); int Oq = (int)-Math.Floor(40 new Random().NextDouble()); int[] rt = { 10 + Zk, 10, 10, 40 + Oq - Zk, 40 }; return rt; }

    public static double GetCmt(DateTime date)
    {
        DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
        TimeSpan start = date.ToUniversalTime() - origin;
        TimeSpan now = DateTime.Now.ToUniversalTime() - origin;
        string value = (now.TotalSeconds - start.TotalSeconds).ToString("#.000");
        return double.Parse(value);
    }

    public static double GetLio(DateTime date)
    {
        DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
        TimeSpan start = date.ToUniversalTime() - origin;
        string value = start.TotalSeconds.ToString("#.000");
        return double.Parse(value);
    }

    private static Random random = new Random();
    public static string GetCPN()
    {
        const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
        return new string(Enumerable.Repeat(chars, 16)
          .Select(s => s[random.Next(s.Length)]).ToArray());
    }

`

Airkek commented 3 years ago

hm thanks

Airkek commented 3 years ago

public static int[] GenerateRT() { int Zk = (int)-Math.Floor(10 new Random().NextDouble()); int Oq = (int)-Math.Floor(40 new Random().NextDouble()); int[] rt = { 10 + Zk, 10, 10, 40 + Oq - Zk, 40 }; return rt; }

wait what is that

Airkek commented 3 years ago

image rt is double, as i know why is there int[]?

IceyTroll commented 3 years ago

yeah you are right. it was my mistake on that one

Airkek commented 3 years ago

Thank you for contributing!