Repository: ytdl-org/youtube-dl

Issue:
WARNING: unable to extract channel id
<!--

######################################################################
  WARNING!
  IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE
######################################################################

-->


## Checklist

<!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.04.30. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
- Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in http://yt-dl.org/escape.
- Search the bugtracker for similar issues: http://yt-dl.org/search-issues. DO NOT post duplicates.
- Read bugs section in FAQ: http://yt-dl.org/reporting
- Finally, put x into all relevant boxes (like this [x])
-->

- [ X ] I'm reporting a broken site support issue
- [ X ] I've verified that I'm running youtube-dl version **2019.04.30**
- [ X ] I've checked that all provided URLs are alive and playable in a browser
- [ X ] I've checked that all URLs and arguments with special characters are properly quoted or escaped
- [ X ] I've searched the bugtracker for similar bug reports including closed ones
- [ X ] I've read bugs section in FAQ


## Verbose log

<!--
Provide the complete verbose output of youtube-dl that clearly demonstrates the problem.
Add the `-v` flag to your command line you run youtube-dl with (`youtube-dl -v <your command line>`), copy the WHOLE output and insert it below. It should look similar to this:
 [debug] System config: []
 [debug] User config: []
 [debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
 [debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
 [debug] youtube-dl version 2019.04.30
 [debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2
 [debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
 [debug] Proxy map: {}
 <more lines>
-->

```
[debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: [u'--verbose', u'-a', u'/home/trekjunky/Documents/downloadlist'] [debug] Batch file urls: [u'https://youtu.be/pSthYb85Jeo', u'https://youtu.be/21GH0QuKF-I', u'https://youtu.be/xgwWkwOac-Y', u'https://youtu.be/Lqi8pGR6yLM', u'https://youtu.be/wq_yGaTUp24'] [debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2019.04.30 [debug] Python version 2.7.14 (CPython) - Linux-4.12.14-lp150.12.58-default-x86_64-with-glibc2.2.5 [debug] exe versions: ffmpeg 3.4.4, ffprobe 3.4.4 [debug] Proxy map: {} [youtube] pSthYb85Jeo: Downloading webpage [youtube] pSthYb85Jeo: Downloading video info webpage WARNING: unable to extract channel id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. [debug] Default format spec: bestvideo+bestaudio/best WARNING: Requested formats are incompatible for merge and will be merged into mkv. [debug] Invoking downloader on u'https://r3---sn-vgqsrnez.googlevideo.com/videoplayback?id=o-AKn9my16mpBH7VpZX-qUBxqdJJuBdyVgL1oYPv-O65EZ&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&itag=137&source=youtube&requiressl=yes&mm=31%2C26&mn=sn-vgqsrnez%2Csn-p5qlsnzd&ms=au%2Conr&mv=m&pl=41&ei=NR7RXNSWD8POwQGYrIj4Dw&initcwndbps=2688750&mime=video%2Fmp4&gir=yes&clen=224656875&dur=588.045&lmt=1557171119712418&mt=1557208578&fvip=6&keepalive=yes&c=WEB&txp=4432432&ip=2601%3A408%3A780%3A2e25%3A%3Ab73d&ipbits=0&expire=1557230229&sparams=ip%2Cipbits%2Cexpire%2Cid%2Caitags%2Csource%2Crequiressl%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cei%2Cinitcwndbps%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&signature=843B30A3EE3577D2AC1C2718866B78F55B3D43BA.E22E84526E6CEB0F59C4469D6D8CF31C3B536542&key=yt8&ratebypass=yes'
```


## Description

<!--
Provide an explanation of your issue in an arbitrary form. Please make sure the description is worded well enough to be understood, see https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient. Provide any additional information, suggested solution and as much context and examples as possible.
If work on your issue requires account credentials please provide them or explain how one can obtain them.
-->

When beginning to download the video, there is a warning about extracting the channel ID and then goes to convert the video to mkv format



Discussion:
I see the same; this started a few hours ago today.

```
git clone https://github.com/ytdl-org/youtube-dl
cd youtube-dl
PYTHONPATH=. python3 -m youtube_dl 'https://www.youtube.com/user/chilledsanity/videos'
```

shows

```
[youtube:user] chilledsanity: Downloading channel page
[youtube:playlist] UUJ6KZTTnkE-s2XFJJmoTAkw: Downloading webpage
[download] Downloading playlist: Uploads from Accursed Farms
[youtube:playlist] UUJ6KZTTnkE-s2XFJJmoTAkw: Downloading page #1
[youtube:playlist] playlist Uploads from Accursed Farms: Downloading 190 videos
[download] Downloading video 1 of 190
[youtube] UKsH7xklMr4: Downloading webpage
[youtube] UKsH7xklMr4: Downloading video info webpage
WARNING: unable to extract channel id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
[download] Destination: May Videochat 2019-UKsH7xklMr4.mp4
[download]  17.3% of 1.11GiB at 64.32MiB/s ETA 00:14^C
ERROR: Interrupted by user
```

I tried with the long version of the URL which I copied from the Browser's address bar and got this:

`~/bin> youtube-dl -v https://www.youtube.com/watch?v=N5xyr1_DhpA
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://www.youtube.com/watch?v=N5xyr1_DhpA']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.04.30
[debug] Python version 2.7.14 (CPython) - Linux-4.12.14-lp150.12.58-default-x86_64-with-glibc2.2.5
[debug] exe versions: ffmpeg 3.4.4, ffprobe 3.4.4
[debug] Proxy map: {}
[youtube] N5xyr1_DhpA: Downloading webpage
[youtube] N5xyr1_DhpA: Downloading video info webpage
WARNING: unable to extract channel id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
[debug] Default format spec: bestvideo+bestaudio/best
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on u'https://r6---sn-vgqsknee.googlevideo.com/videoplayback?id=o-ALenPzuo5tbOEVkStn6OGKFHuahPDwpA_e1zok7aZCpd&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&itag=137&source=youtube&requiressl=yes&mm=31%2C26&mn=sn-vgqsknee%2Csn-p5qs7nee&ms=au%2Conr&mv=m&pl=41&ei=9STRXM2eEPGNir4P_5aH6Aw&initcwndbps=1932500&mime=video%2Fmp4&gir=yes&clen=214099177&dur=1087.933&lmt=1557198256881382&mt=1557210271&fvip=6&keepalive=yes&c=WEB&txp=5535432&ip=2601%3A408%3A780%3A2e25%3A%3Ab73d&ipbits=0&expire=1557231957&sparams=ip%2Cipbits%2Cexpire%2Cid%2Caitags%2Csource%2Crequiressl%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cei%2Cinitcwndbps%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&signature=8A6E37335CE566E4687C604C4A89EF74E0F47BB4.B498E65B5E1DAAD0E292993493D74CE702D93C7C&key=yt8&ratebypass=yes'
[download] Destination: Embassy Protectors Assaulted (Plus Viewer Questions)-N5xyr1_DhpA.f137.mp4
[download] 100% of 204.18MiB in 01:07
[debug] Invoking downloader on u'https://r6---sn-vgqsknee.googlevideo.com/videoplayback?id=o-ALenPzuo5tbOEVkStn6OGKFHuahPDwpA_e1zok7aZCpd&itag=251&source=youtube&requiressl=yes&mm=31%2C26&mn=sn-vgqsknee%2Csn-p5qs7nee&ms=au%2Conr&mv=m&pl=41&ei=9STRXM2eEPGNir4P_5aH6Aw&initcwndbps=1932500&mime=audio%2Fwebm&gir=yes&clen=17305644&dur=1087.961&lmt=1557197357248102&mt=1557210271&fvip=6&keepalive=yes&c=WEB&txp=5531432&ip=2601%3A408%3A780%3A2e25%3A%3Ab73d&ipbits=0&expire=1557231957&sparams=ip%2Cipbits%2Cexpire%2Cid%2Citag%2Csource%2Crequiressl%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cei%2Cinitcwndbps%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&signature=EE3AEE3D91FFB51F91168E3E244D13FD35C3F2F8.C3CAEFD0FE8D267BB15AF7F9A39F3F752124AB8E&key=yt8&ratebypass=yes'
[download] Destination: Embassy Protectors Assaulted (Plus Viewer Questions)-N5xyr1_DhpA.f251.webm
[download] 100% of 16.50MiB in 00:05
[ffmpeg] Merging formats into "Embassy Protectors Assaulted (Plus Viewer Questions)-N5xyr1_DhpA.mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Embassy Protectors Assaulted (Plus Viewer Questions)-N5xyr1_DhpA.f137.mp4' -i 'file:Embassy Protectors Assaulted (Plus Viewer Questions)-N5xyr1_DhpA.f251.webm' -c copy -map '0:v:0' -map '1:a:0' 'file:Embassy Protectors Assaulted (Plus Viewer Questions)-N5xyr1_DhpA.temp.mkv'
Deleting original file Embassy Protectors Assaulted (Plus Viewer Questions)-N5xyr1_DhpA.f137.mp4 (pass -k to keep)
Deleting original file Embassy Protectors Assaulted (Plus Viewer Questions)-N5xyr1_DhpA.f251.webm (pass -k to keep)`
same problem here

Resolving patch:
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -2100,8 +2100,13 @@ def _extract_filesize(media_url):
         else:
             self._downloader.report_warning('unable to extract uploader nickname')
 
-        channel_id = self._html_search_meta(
-            'channelId', video_webpage, 'channel id')
+        channel_id = (
+            str_or_none(video_details.get('channelId')) or
+            self._html_search_meta(
+                'channelId', video_webpage, 'channel id', default=None) or
+            self._search_regex(
+                r'data-channel-external-id=(["\'])(?P<id>(?:(?!\1).)+)\1',
+                video_webpage, 'channel id', default=None, group='id'))
         channel_url = 'http://www.youtube.com/channel/%s' % channel_id if channel_id else None
 
         # thumbnail image


Test patch: