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.28k stars 9.94k forks source link

Chelsea FC #31412

Open yossibiton opened 1 year ago

yossibiton commented 1 year ago

Checklist

Example URLs

Description

Videos of Chelsea FC

dirkf commented 1 year ago

Obvs more chance of getting qpr.co.uk implemented, but this might be quite straightforward for someone who cares.

  1. In the web page find the <div> element with data-component="VideoDetails".
  2. Extract the value of its data-props attribute.
  3. Decode the HTML-encoded (eg &quot;) string.
  4. Parse the resulting string as JSON.
  5. Extract the videoDetail.signedUrl member of the JSON (a time-limited JWPlayer manifest) into a url_transparent result.
  6. Add the other metadata from the videoDetail member.
  7. Return the result.
video-details JSON

{
  'videoDetail': {
    'autoPlay': true,
    'sharePlatforms': [
      {
        'key': 0,
        'id': 'facebook',
        'name': 'Facebook',
        'mobileOnly': false
      },
      {
        'key': 1,
        'id': 'twitter',
        'name': 'Twitter',
        'mobileOnly': false
      },
      {
        'key': 2,
        'id': 'copy-link',
        'name': 'copyLink',
        'mobileOnly': false
      }
    ],
    'title': 'FIRST HALF: Manchester United v Chelsea (A)',
    'description': 'Watch the full first-half of our Premier League match v Manchester United at Old Trafford.',
    'provider': 'jwplayer',
    'releaseDate': '2019-08-11T22:00:00.0000000+00:00',
    'duration': '51:13',
    'image': {
      'id': 'editorial/news/2019/8/pulisic-united-DAZ_5152-527270_2019081160815175_copy',
      'title': 'FIRST HALF: Manchester United v Chelsea (A)',
      'description': '',
      'file': {
        'fileName': 'editorial/news/2019/8/pulisic-united-DAZ_5152-527270_2019081160815175_copy',
        'contentType': 'image',
        'type': 'upload',
        'format': 'jpg',
        'url': 'http://img.chelseafc.com/image/upload/v1565547070/editorial/news/2019/8/pulisic-united-DAZ_5152-527270_2019081160815175_copy.jpg',
        'urlObject': {
          'baseUrl': 'https://res.cloudinary.com/',
          'cloudName': 'chelsea-production',
          'resourceType': 'image',
          'type': 'upload',
          'publicId': 'editorial/news/2019/8/pulisic-united-DAZ_5152-527270_2019081160815175_copy'
        },
        'details': {
          'size': 1149397,
          'transformations': '',
          'image': {
            'width': 3772,
            'height': 2514
          }
        }
      },
      'coordinates': [
      ]
    },
    'category': {
      'id': 'fe3e08c7-4c3a-41b5-a271-76bb48f02454',
      'title': 'Men\'s Team',
      'url': '/en/news/category/mens-team',
      'isExternal': false,
      'isActive': false
    },
    'tags': [
      {
        'id': '66696593-ff1d-4099-a2d2-7457cfd21d99',
        'title': 'Manchester United',
        'url': '/en/news/tag/manchester-united',
        'isExternal': false,
        'isActive': false
      },
      {
        'id': '9243d121-0cb3-46de-8790-16a98fe9f3ca',
        'title': 'Men',
        'url': '/en/news/tag/men',
        'isExternal': false,
        'isActive': false
      }
    ],
    'signedUrl': 'https://cdn.jwplayer.com/manifests/ot0ooPZ4.m3u8?exp=1670760442&sig=e80b386bd44059c8e4710490471d0a81',
    'inline': false,
    'playerScriptUrl': 'https://cdn.jwplayer.com/libraries/NHgCkCEX.js?exp=1670760442&sig=97c6fbcad37db8df274efdf5aefd1df0',
    'type': 'video'
  },
  'links': [
  ],
  'upNext': {
    'items': [
      {
        'id': '2QfyzITXFZHXSCGcChR1k1',
        'title': 'Villa in view',
        'type': 'Video',
        'category': {
          'id': '4b17f0e6-ba4d-4093-8e70-25fe5c77ba22',
          'title': 'Video',
          'url': '/en/news/category/video',
          'isExternal': false,
          'isActive': false
        },
        'date': '2022-12-11T08:00:00.0000000+00:00',
        'url': '/en/video/villa-in-view',
        'thumbnail': {
          'id': 'video/2022/12/10/10122022_Standard_TRAINING_WIDE-Recovered',
          'title': 'video/2022/12/10/10122022_Standard_TRAINING_WIDE-Recovered',
          'description': '',
          'credit': '',
          'file': {
            'fileName': 'video/2022/12/10/10122022_Standard_TRAINING_WIDE-Recovered',
            'contentType': 'image',
            'type': 'upload',
            'format': 'jpg',
            'url': 'http://img.chelseafc.com/image/upload/v1670711952/video/2022/12/10/10122022_Standard_TRAINING_WIDE-Recovered.jpg',
            'urlObject': {
              'baseUrl': 'https://res.cloudinary.com/',
              'cloudName': 'chelsea-production',
              'resourceType': 'image',
              'type': 'upload',
              'publicId': 'video/2022/12/10/10122022_Standard_TRAINING_WIDE-Recovered'
            },
            'details': {
              'size': 555078,
              'transformations': '',
              'image': {
                'width': 1920,
                'height': 1080
              }
            }
          },
          'coordinates': [
          ]
        },
        'videoId': 'Vs9g9Dys',
        'isBoxSet': false
      },
      {
        'id': '3WUfLQ1tovsnn7LgN8NqTk',
        'title': 'Last days in Abu Dhabi',
        'type': 'Video',
        'category': {
          'id': '414e00cd-d144-4bb4-9210-d4bb19e28000',
          'title': 'Video',
          'url': '/en/news/category/video',
          'isExternal': false,
          'isActive': false
        },
        'date': '2022-12-10T21:00:00.0000000+00:00',
        'url': '/en/video/last-days-in-abu-dhabi',
        'thumbnail': {
          'id': 'video/2022/12/10/09122022_v2_Standard_TRAINING_WIDE-Recovered',
          'title': 'video/2022/12/10/09122022_v2_Standard_TRAINING_WIDE-Recovered',
          'description': '',
          'credit': '',
          'file': {
            'fileName': 'video/2022/12/10/09122022_v2_Standard_TRAINING_WIDE-Recovered',
            'contentType': 'image',
            'type': 'upload',
            'format': 'jpg',
            'url': 'http://img.chelseafc.com/image/upload/v1670709445/video/2022/12/10/09122022_v2_Standard_TRAINING_WIDE-Recovered.jpg',
            'urlObject': {
              'baseUrl': 'https://res.cloudinary.com/',
              'cloudName': 'chelsea-production',
              'resourceType': 'image',
              'type': 'upload',
              'publicId': 'video/2022/12/10/09122022_v2_Standard_TRAINING_WIDE-Recovered'
            },
            'details': {
              'size': 506550,
              'transformations': '',
              'image': {
                'width': 1920,
                'height': 1080
              }
            }
          },
          'coordinates': [
          ]
        },
        'videoId': 'P5ZrLueQ',
        'isBoxSet': false
      },
      {
        'id': 'YOUdDPjYpTYJZM3Curn7A',
        'title': 'Time to hear from Reece! 🎤',
        'type': 'Video',
        'category': {
          'id': '6ffb962e-da60-416d-aa0b-bfe44d1d0ad7',
          'title': 'Video',
          'url': '/en/news/category/video',
          'isExternal': false,
          'isActive': false
        },
        'date': '2022-12-10T11:30:00.0000000+00:00',
        'url': '/en/video/reece-james-wt-16x9',
        'thumbnail': {
          'id': 'video/2022/12/09/Reece_James_Walk_and_Talk_Standard_TRAINING_WIDE-Recovered',
          'title': 'video/2022/12/09/Reece_James_Walk_and_Talk_Standard_TRAINING_WIDE-Recovered',
          'description': '',
          'credit': '',
          'file': {
            'fileName': 'video/2022/12/09/Reece_James_Walk_and_Talk_Standard_TRAINING_WIDE-Recovered',
            'contentType': 'image',
            'type': 'upload',
            'format': 'jpg',
            'url': 'http://img.chelseafc.com/image/upload/v1670629917/video/2022/12/09/Reece_James_Walk_and_Talk_Standard_TRAINING_WIDE-Recovered.jpg',
            'urlObject': {
              'baseUrl': 'https://res.cloudinary.com/',
              'cloudName': 'chelsea-production',
              'resourceType': 'image',
              'type': 'upload',
              'publicId': 'video/2022/12/09/Reece_James_Walk_and_Talk_Standard_TRAINING_WIDE-Recovered'
            },
            'details': {
              'size': 318400,
              'transformations': '',
              'image': {
                'width': 1920,
                'height': 1080
              }
            }
          },
          'coordinates': [
          ]
        },
        'videoId': 'BZwH0k9k',
        'isBoxSet': false
      }
    ],
    'title': 'Up next...',
    'isBoxSet': false
  },
  'isBoxset': false,
  'googleAd': {
    'id': 'web_sitewide_banner',
    'minWidth': 300,
    'minHeight': 90
  }
}
andyjphu commented 1 year ago

Novice Here: But I tried following @dirkf's instructions and I can't do the first step or try going around it, either because the site changed or because I don't know enough--and if that's the case, are there any resources that are good to learn how to do this?

dirkf commented 1 year ago

The listed steps are straightforward for implementation in an extractor.

To do the same things manually, you'd need to be skilled in the use of your browser's development tools and JavaScript. There's a whole WWW to help you.