A feature-rich command-line audio/video downloader
Make sure netrc works for all extractors with login support
Philipp Hagemeister499bfcbfd09e
diff --git a/test/test_netrc.py b/test/test_netrc.pynew file mode 100644index 0000000000..7cf3a6a2e6--- /dev/null+++ b/test/test_netrc.py@@ -0,0 +1,26 @@+# coding: utf-8+from __future__ import unicode_literals++import os+import sys+import unittest+sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+++from youtube_dl.extractor import (+ gen_extractors,+)+++class TestNetRc(unittest.TestCase):+ def test_netrc_present(self):+ for ie in gen_extractors():+ if not hasattr(ie, '_login'):+ continue+ self.assertTrue(+ hasattr(ie, '_NETRC_MACHINE'),+ 'Extractor %s supports login, but is missing a _NETRC_MACHINE property' % ie.IE_NAME)+++if __name__ == '__main__':+ unittest.main()diff --git a/youtube_dl/extractor/atresplayer.py b/youtube_dl/extractor/atresplayer.pyindex 7669e0e3dc..29f8795d3d 100644--- a/youtube_dl/extractor/atresplayer.py+++ b/youtube_dl/extractor/atresplayer.py@@ -19,6 +19,7 @@ from ..utils import (class AtresPlayerIE(InfoExtractor):_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/television/[^/]+/[^/]+/[^/]+/(?P<id>.+?)_\d+\.html'+ _NETRC_MACHINE = 'atresplayer'_TESTS = [{'url': 'http://www.atresplayer.com/television/programas/el-club-de-la-comedia/temporada-4/capitulo-10-especial-solidario-nochebuena_2014122100174.html',diff --git a/youtube_dl/extractor/crunchyroll.py b/youtube_dl/extractor/crunchyroll.pyindex f1da7d09bc..e64b88fbc4 100644--- a/youtube_dl/extractor/crunchyroll.py+++ b/youtube_dl/extractor/crunchyroll.py@@ -29,6 +29,7 @@ from ..aes import (class CrunchyrollIE(InfoExtractor):_VALID_URL = r'https?://(?:(?P<prefix>www|m)\.)?(?P<url>crunchyroll\.(?:com|fr)/(?:[^/]*/[^/?&]*?|media/\?id=)(?P<video_id>[0-9]+))(?:[/?&]|$)'+ _NETRC_MACHINE = 'crunchyroll'_TESTS = [{'url': 'http://www.crunchyroll.com/wanna-be-the-strongest-in-the-world/episode-1-an-idol-wrestler-is-born-645513','info_dict': {diff --git a/youtube_dl/extractor/gdcvault.py b/youtube_dl/extractor/gdcvault.pyindex f7b467b0af..51796f3a40 100644--- a/youtube_dl/extractor/gdcvault.py+++ b/youtube_dl/extractor/gdcvault.py@@ -12,6 +12,7 @@ from ..utils import remove_endclass GDCVaultIE(InfoExtractor):_VALID_URL = r'https?://(?:www\.)?gdcvault\.com/play/(?P<id>\d+)/(?P<name>(\w|-)+)'+ _NETRC_MACHINE = 'gdcvault'_TESTS = [{'url': 'http://www.gdcvault.com/play/1019721/Doki-Doki-Universe-Sweet-Simple',diff --git a/youtube_dl/extractor/lynda.py b/youtube_dl/extractor/lynda.pyindex 1f02bef445..cfd3b14f4b 100644--- a/youtube_dl/extractor/lynda.py+++ b/youtube_dl/extractor/lynda.py@@ -19,6 +19,7 @@ class LyndaBaseIE(InfoExtractor):_LOGIN_URL = 'https://www.lynda.com/login/login.aspx'_SUCCESSFUL_LOGIN_REGEX = r'isLoggedIn: true'_ACCOUNT_CREDENTIALS_HINT = 'Use --username and --password options to provide lynda.com account credentials.'+ _NETRC_MACHINE = 'lynda'def _real_initialize(self):self._login()diff --git a/youtube_dl/extractor/twitch.py b/youtube_dl/extractor/twitch.pyindex 4b0ce54df4..8af1361473 100644--- a/youtube_dl/extractor/twitch.py+++ b/youtube_dl/extractor/twitch.py@@ -23,6 +23,7 @@ class TwitchBaseIE(InfoExtractor):_API_BASE = 'https://api.twitch.tv'_USHER_BASE = 'http://usher.twitch.tv'_LOGIN_URL = 'https://secure.twitch.tv/user/login'+ _NETRC_MACHINE = 'twitch'def _handle_error(self, response):if not isinstance(response, dict):