quer / the-steam-awards

Steam multi account module/event (get updates when event for steam)
95 stars 13 forks source link

View a broadcast won't work #34

Closed SENPAY98K closed 2 years ago

SENPAY98K commented 2 years ago

I am trying to do the task of view a broadcase in the community badge, and i was not able to manage it, idk why tho

module.exports = function(steamClient, RequestCommunity, RequestStore, SessionID, options, callback){
var ViewBroadcast = {
    headers: {
        Host: 'steamcommunity.com',
        Referer: 'https://steamcommunity.com/?subsection=broadcasts'
    },
    json: true
};
var BroadcasterID64 = "76561198985577189";
var postURL02 = 'https://steamcommunity.com/broadcast/watch/'+BroadcasterID64+'/';

RequestCommunity.Post(postURL02, ViewBroadcast, function (err, res, data) {
    if (err) {
        console.log('View Broadcast: FAIL');
    }
    if (!err) {
        console.log('View Broadcast: DONE');
    }
});
});

no error, but did not work!! any suggestion ?

quer commented 2 years ago

yes, but there are no easy way. i did look into this. and there is no simple "post". i did try a lot of thinks. but i ended up. giving up.

I think it registered, if you are connected to the socket, that the stream is running on.

SENPAY98K commented 2 years ago

I even tried with Get method and did not work. Anyway thanks for trying 😃

HenkerX64 commented 2 years ago

Probably to late, but I wrote a script that can solve the most community badge quests, the broadcast view task I solved with following steps:

  1. find trend broadcasts: https://steamcommunity.com/apps/allcontenthome/?l=english&appHubSubSection=13
  2. pick a link href and cut the watchId (probably you can skip this step if you configure your watchId)
  3. then call https://steamcommunity.com/broadcast/getbroadcastmpd/?steamid=#WatchId#&sessionid=#&broadcastid=0&viewertoken=0&watchlocation=5 with
    headers: {
            'Origin': 'https://steamcommunity.com',
            'Referer': 'https://steamcommunity.com/broadcast/watch/' + watchId
        },

All request are done with GET, watchId is a steamId from streamer. Then the task should be marked as solved. You can just do the step 3 if you predefine the watchid yourself.

If anyone have interest on community badge solution, let me know and I will publish my solution as merge request.

HenkerX64 commented 2 years ago

I changed your solution, try it out, but don't forget to change the broadcast stream id to actual one:

module.exports = function (steamClient, RequestCommunity, RequestStore, SessionID, options, callback) {
    var BroadcasterID64 = "xxxxx";
    var ViewBroadcast = {
        headers: {
            'Origin': 'https://steamcommunity.com',
            'Referer': 'https://steamcommunity.com/broadcast/watch/' + BroadcasterID64
        },
        qs: {
            'steamid': BroadcasterID64,
            'sessionid': SessionID,
            'broadcastid': 0,
            'viewertoken': 0,
            'watchlocation': 5,
        },
        json: true
    };
    var url = 'https://steamcommunity.com/broadcast/getbroadcastmpd/';

    RequestCommunity.get(url, ViewBroadcast, function (err, res, data) {
        if (!err && data && data.success === 'ready') {
            console.log('View Broadcast: DONE');
        } else {
            console.log('View Broadcast: FAIL');
        }
        callback();
    });
};
SENPAY98K commented 2 years ago

I changed your solution, try it out, but don't forget to change the broadcast stream id to actual one:

@HenkerX64 works flawless, thanks.

quer commented 2 years ago

i would like to see the community badge solution.

HenkerX64 commented 2 years ago

ok, then I will prepare the code and create a MR tomorrow