Sync with the version shared upstream - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
 (HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) changeset e1e060698b07c4f0da6882d59b5f26eb5d9038d9
 (DIR) parent 8f743eff9f2042cde48321bd10c2a89f2b220b30
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Sun, 10 Nov 2019 23:38:13 
       
       Sync with the version shared upstream
       
       Diffstat:
        net/youtube-dl/patch-youtube__dl_extractor_rai.py |  46 +++++++++++++++-------
        1 files changed, 31 insertions(+), 15 deletions(-)
       ---
       diff -r 8f743eff9f20 -r e1e060698b07 net/youtube-dl/patch-youtube__dl_extractor_rai.py
       --- a/net/youtube-dl/patch-youtube__dl_extractor_rai.py Sun Nov 10 16:50:20 2019 +0100
       +++ b/net/youtube-dl/patch-youtube__dl_extractor_rai.py Sun Nov 10 23:38:13 2019 +0100
       @@ -1,11 +1,28 @@
        $NetBSD$
        
       -Preliminary workaround for raiplay.it updates... RaiPlay, RaiPlayLive,
       -RaiPlayPlaylist were analyzed and adjusted.
       +[rai] Fix extraction for recent raiplay.it updates
        
       ---- youtube_dl/extractor/rai.py.orig   2019-11-10 15:05:12.469788971 +0000
       +- Introduce _BASE_URL in RaiBaseIE class so it could be reused as base for the
       +  several subextractors.
       +- Remove first test of RaiPlayIE, it is no longer available
       +- Adjust RaiPlayIE to recent raiplay.it updates, make it extension agnostic
       +  (passing possible `.json' URLs is now supported too) and update test
       +  info_dict.
       +- Adjust RaiPlayLiveIE to recent raiplay.it updates.  Passing it as
       +  `url_transparent' is no longer supported (there is no longer an accessible
       +  ContentItem)
       +- Adjust RaiPlayPlaylistIE to recent raiplay.it updates and instruct it about
       +  ContentSet-s.
       +
       +This fix issue #22923, #22906 and supersedes #23006.
       +
       +Shared upstream via:
       +
       + https://github.com/ytdl-org/youtube-dl/pull/23040
       +
       +--- youtube_dl/extractor/rai.py.orig
        +++ youtube_dl/extractor/rai.py
       -@@ -17,7 +17,6 @@ from ..utils import (
       +@@ -17,7 +17,6 @@
             parse_duration,
             strip_or_none,
             try_get,
       @@ -21,7 +38,7 @@
         
             def _extract_relinker_info(self, relinker_url, video_id):
                 if not re.match(r'https?://', relinker_url):
       -@@ -122,41 +122,19 @@ class RaiBaseIE(InfoExtractor):
       +@@ -122,41 +122,19 @@ def _extract_subtitles(url, subtitle_url):
         
         
         class RaiPlayIE(RaiBaseIE):
       @@ -87,7 +104,7 @@
                 self._sort_formats(relinker_info['formats'])
         
                 thumbnails = []
       -@@ -185,7 +162,7 @@ class RaiPlayIE(RaiBaseIE):
       +@@ -185,7 +162,7 @@ def _real_extract(self, url):
                     for _, value in media.get('images').items():
                         if value:
                             thumbnails.append({
       @@ -112,23 +129,22 @@
        -        webpage = self._download_webpage(url, display_id)
        +        media = self._download_json(
        +            '%s.json' % urljoin(RaiBaseIE._BASE_URL, 'dirette/' + display_id),
       -+                        display_id, 'Downloading channel JSON')
       ++            display_id, 'Downloading channel JSON')
         
        -        video_id = self._search_regex(
        -            r'data-uniquename=["\']ContentItem-(%s)' % RaiBaseIE._UUID_RE,
        -            webpage, 'content id')
       --
       --        return {
       --            '_type': 'url_transparent',
       --            'ie_key': RaiPlayIE.ie_key(),
       --            'url': 'http://www.raiplay.it/dirette/ContentItem-%s.html' % video_id,
        +        title = media['name']
        +        video = media['video']
        +        video_id = media['id'].replace('ContentItem-', '')
        +
        +        relinker_info = self._extract_relinker_info(video['content_url'], video_id)
        +        self._sort_formats(relinker_info['formats'])
       -+
       + 
       +-        return {
       +-            '_type': 'url_transparent',
       +-            'ie_key': RaiPlayIE.ie_key(),
       +-            'url': 'http://www.raiplay.it/dirette/ContentItem-%s.html' % video_id,
        +        info = {
                     'id': video_id,
                     'display_id': display_id,
       @@ -163,7 +179,7 @@
        -        webpage = self._download_webpage(url, playlist_id)
        +        media = self._download_json(
        +            '%s.json' % urljoin(RaiBaseIE._BASE_URL, 'programmi/' + playlist_id),
       -+                        playlist_id, 'Downloading program JSON')
       ++            playlist_id, 'Downloading program JSON')
        +
        +        title = media['name']
        +        description = media['program_info']['description']
       @@ -185,7 +201,7 @@
        +        for cs in content_sets:
        +            medias = self._download_json(
        +                '%s/%s.json' % (urljoin(RaiBaseIE._BASE_URL, 'programmi/' + playlist_id), cs),
       -+                               cs, 'Downloading content set JSON')
       ++                cs, 'Downloading content set JSON')
        +            for m in medias['items']:
        +                video_url = urljoin(url, m['path_id'])
        +                entries.append(self.url_result(