Repository: ytdl-org/youtube-dl

Issue:
TV Noe (Czech Christian TV)
- [x] I've **verified** and **I assure** that I'm running youtube-dl **2016.08.31**
- [x] At least skimmed through [README](https://github.com/rg3/youtube-dl/blob/master/README.md) and **most notably** [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections
- [x] [Searched](https://github.com/rg3/youtube-dl/search?type=Issues) the bugtracker for similar issues including closed ones
### What is the purpose of your _issue_?
- [ ] Bug report (encountered problems with youtube-dl)
- [x] Site support request (request for adding support for a new site)
- [ ] Feature request (request for a new functionality)
- [ ] Question
- [ ] Other

```
matej@mitmanek: ~$ youtube-dl -v --xattrs 'http://www.tvnoe.cz/video/10362'
[debug] System config: [u'--prefer-free-formats']
[debug] User config: []
[debug] Command-line args: [u'-v', u'--xattrs', u'http://www.tvnoe.cz/video/10362']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.08.31
[debug] Python version 2.7.5 - Linux-3.10.0-498.el7.x86_64-x86_64-with-redhat-7.3-Maipo
[debug] exe versions: ffmpeg 2.6.8, ffprobe 2.6.8, rtmpdump 2.4
[debug] Proxy map: {}
[generic] 10362: Requesting header
WARNING: Falling back on generic information extractor.
[generic] 10362: Downloading webpage
[generic] 10362: Extracting information
ERROR: Unsupported URL: http://www.tvnoe.cz/video/10362
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/youtube_dl/extractor/generic.py", line 1644, in _real_extract
    doc = compat_etree_fromstring(webpage.encode('utf-8'))
  File "/usr/lib/python2.7/site-packages/youtube_dl/compat.py", line 2525, in compat_etree_fromstring
    doc = _XML(text, parser=etree.XMLParser(target=_TreeBuilder(element_factory=_element_factory)))
  File "/usr/lib/python2.7/site-packages/youtube_dl/compat.py", line 2514, in _XML
    parser.feed(text)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1642, in feed
    self._raiseerror(v)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror
    raise err
ParseError: junk after document element: line 51, column 0
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 691, in extract_info
    ie_result = ie.extract(url)
  File "/usr/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 347, in extract
    return self._real_extract(url)
  File "/usr/lib/python2.7/site-packages/youtube_dl/extractor/generic.py", line 2388, in _real_extract
    raise UnsupportedError(url)
UnsupportedError: Unsupported URL: http://www.tvnoe.cz/video/10362
...
<end of log>
```
## \- Single video: http://www.tvnoe.cz/video/10362

Plain MP4 file can be downloaded at http://video.tvnoe.cz/media/b85614af1b14e3b9c272361f87f1b301/57c7fb31/nunxb/nunxb0130.404p.mp4



Discussion:
Apparently, when the correct iframe is found, then `youtube-dl 'http://video.tvnoe.cz/getVideo.php?code=bnVzbjEwYjAxMzA='` works with a generic extractor.


Resolving patch:
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -916,6 +916,7 @@
 )
 from .tvigle import TvigleIE
 from .tvland import TVLandIE
+from .tvnoe import TVNoeIE
 from .tvp import (
     TVPEmbedIE,
     TVPIE,
diff --git a/youtube_dl/extractor/tvnoe.py b/youtube_dl/extractor/tvnoe.py
new file mode 100644
--- /dev/null
+++ b/youtube_dl/extractor/tvnoe.py
@@ -0,0 +1,44 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .jwplatform import JWPlatformBaseIE
+from ..utils import clean_html, get_element_by_class, js_to_json
+
+
+class TVNoeIE(JWPlatformBaseIE):
+    _VALID_URL = r'https?://(www\.)?tvnoe\.cz/video/(?P<id>[0-9]+)'
+    _TEST = {
+        'url': 'http://www.tvnoe.cz/video/10362',
+        'md5': 'aee983f279aab96ec45ab6e2abb3c2ca',
+        'info_dict': {
+            'id': '10362',
+            'ext': 'mp4',
+            'series': 'Noční univerzita',
+            'title': 'prof. Tomáš Halík, Th.D. - ' +
+                     'Návrat náboženství a střet civilizací',
+            'description': 'md5:f337bae384e1a531a52c55ebc50fff41',
+        }
+    }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
+
+        iframe_url = self._search_regex(r'<iframe[^>]+src="([^"]+)"',
+                                        webpage, 'iframe src attribute')
+
+        ifs_page = self._download_webpage(iframe_url, video_id)
+        jwplayer_data = self._parse_json(self._find_jwplayer_data(ifs_page),
+                                         video_id, transform_source=js_to_json)
+        info_dict = self._parse_jwplayer_data(
+            jwplayer_data, video_id, require_title=False, base_url=iframe_url)
+
+        info_dict.update({
+            'id': video_id,
+            'title': clean_html(
+               get_element_by_class('field-name-field-podnazev', webpage)),
+            'description': clean_html(get_element_by_class('field-name-body',
+                                                           webpage)),
+            'series': clean_html(get_element_by_class('title', webpage))
+        })
+        return info_dict


Test patch: