ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.69k stars 9.97k forks source link

Kick support #31430

Open DealsBeam opened 1 year ago

DealsBeam commented 1 year ago

Checklist

Example URLs

Description

No login credentials needed, the website is basically a twitch clone

dirkf commented 1 year ago

In the page is JS variable const Zippy whose value defines the site:

{
  'url': 'https://kick.com',
  'port': null,
  'defaults': {
  },
  /* --- snipped lots of APIs --- */
    'api.search': {
      'uri': 'api/search',
      'methods': [
        'GET',
        'HEAD'
      ]
    },
  /* --- snipped lots of APIs --- */
    'video.show': {
      'uri': 'api/v1/video/{video}',
      'methods': [
        'GET',
        'HEAD'
      ],
      'bindings': {
        'video': 'uuid'
      }
    },
    'video.delete': {
      'uri': 'api/v1/video/{video}',
      'methods': [
        'DELETE'
      ],
      'bindings': {
        'video': 'uuid'
      }
    },
  /* --- snipped lots of APIs --- */
  }
}

So let's look at https://kick.com/api/v1/video/82a3c11d-7a17-4747-aecb-2e61413eb11f:

{
  'id': 28440,
  'live_stream_id': 31814,
  'slug': null,
  'thumb': null,
  's3': null,
  'trading_platform_id': null,
  'created_at': '2022-12-17T15:02:05.000000Z',
  'updated_at': '2022-12-21T11:26:30.000000Z',
  'uuid': '82a3c11d-7a17-4747-aecb-2e61413eb11f',
  'views': 742,
  'source': 'https://stream.kick.com/ivs/v1/196233775518/xJf2jIQZk382/2022/12/17/12/30/4uV5fWgp8QfV/media/hls/master.m3u8',
  'livestream': {
    'id': 31814,
    'slug': 'b17d6-weekly-stake-stream',
    'channel_id': 22,
    'created_at': '2022-12-17 12:33:14',
    'session_title': 'Weekly Stake Stream',
    'is_live': false,
    'source': 'obs',
    'twitch_channel': null,
    'duration': 9007000,
    'thumbnail': 'https://kick-prod-videos.s3.us-west-2.amazonaws.com/thumbnails/livestream/31814/thumb145/video_thumbnail/thumb145.jpg?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAS3MDRZGPPQDUDQXQ%2F20221221%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20221221T112631Z&X-Amz-SignedHeaders=host&X-Amz-Expires=300&X-Amz-Signature=876d88673a61419800f0df4951ee3b121e351e80ed6dad2b7cee3d99b81fdfdd',
    'channel': {
      'id': 22,
      'user_id': 22,
      'slug': 'eddie',
      'playback_url': 'https://fa723fc1b171.us-west-2.playback.live-video.net/api/video/v1/us-west-2.196233775518.channel.xJf2jIQZk382.m3u8',
      'name_updated_at': null,
      'followersCount': 11447,
      'user': {
        'profilepic': 'https://d2egosedh0nm8l.cloudfront.net/images/user/22/profile_image/358e5d87-be7f-4b39-aed3-aa3d9df8203a',
        'bio': 'Eddie from Stake. Streaming every Saturday at 12:30pm GMT with Steve & Mikey. Whole heap of giveaways to enter and bonuses to be won. Happily answering any questions people might have about Stake!',
        'twitter': 'StakeEddie',
        'facebook': null,
        'instagram': null,
        'youtube': null,
        'discord': 'PrimeEdd',
        'tiktok': null,
        'username': 'Eddie'
      },
      'verified': {
        'id': 26,
        'channel_id': 22,
        'created_at': '2022-12-12T16:48:07.000000Z',
        'updated_at': '2022-12-12T16:48:07.000000Z'
      }
    },
    'categories': [
      {
        'id': 28,
        'category_id': 4,
        'name': 'Slots & Casino',
        'slug': 'slots',
        'tags': [
          'Gambling'
        ],
        'description': null,
        'category': {
          'id': 4,
          'name': 'Gambling',
          'slug': 'gambling',
          'icon': '🎰'
        }
      }
    ]
  }
}

This is all that's needed for basic video extraction with metadata.

shubham-singh-748 commented 1 year ago

hey is this issue still available, if yes can i work on this?

dirkf commented 1 year ago

Please review the linked PR if you wish.

DealsBeam commented 1 year ago

Single video link in OP has been removed, try this one https://kick.com/video/7237f151-70e4-439c-8306-2a7b0b0cc366

aaron-tan commented 1 year ago

Video link above has also been removed, tried using this one: https://kick.com/video/e466d965-b67d-471d-bed5-e3d4f19a4a9d but unfortunately it returned HTTP 403: forbidden error. Could be a bug?

I've had a look at https://github.com/yt-dlp/yt-dlp/issues/6748 and it seems to be an issue with cloudflare fingerprinting. I've tried the solutions offered like using my browser's user-agent string: python -m youtube_dl -v --user-agent ''USER AGENT'' https://kick.com/video/56292fc4-98fe-4fc8-8267-8082651bde12 but unfortunately it did not work for me. I've tried passing cookies from browser but there is no --cookies-from-browser option in youtube-dl (a new feature for the future maybe?) but no success it still returns HTTP 403: forbidden error.

mccarreon commented 8 months ago

I tried using the Kick implementation from #31576 and it was working at first, but then started getting 403's as well. Probably still due to the cloudflare fingerprinting I'm guessing.

I have a branch with the code from #31576 for VOD's and have a clip extractor too, not sure if we are still wanting to add functionality if the 403's are happening due to the cloudflare issue?