Merge branch 'master' of github.com:rg3/youtube-dl
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sun, 31 Aug 2014 21:47:26 +0000 (23:47 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sun, 31 Aug 2014 21:47:26 +0000 (23:47 +0200)
1  2 
youtube_dl/extractor/youtube.py

index a8d7bc343b3e3f281cb585b70ad1adbc14fc9018,3417c1275a972d6cfaf98b74e72bf60bbc6f33f4..78f3b7e7bddb1b085c96ae41696837178c2f42aa
@@@ -316,6 -316,8 +316,8 @@@ class YoutubeIE(YoutubeBaseInfoExtracto
                  u"upload_date": u"20121002",
                  u"description": u"test chars:  \"'/\\ä↭𝕐\ntest URL: https://github.com/rg3/youtube-dl/issues/1892\n\nThis is a test video for youtube-dl.\n\nFor more information, contact phihag@phihag.de .",
                  u"categories": [u'Science & Technology'],
+                 'like_count': int,
+                 'dislike_count': int,
              }
          },
          {
              upload_date = ' '.join(re.sub(r'[/,-]', r' ', mobj.group(1)).split())
              upload_date = unified_strdate(upload_date)
  
-         m_cat_container = get_element_by_id("eow-category", video_webpage)
+         m_cat_container = self._search_regex(
+             r'(?s)<h4[^>]*>\s*Category\s*</h4>\s*<ul[^>]*>(.*?)</ul>',
+             video_webpage, 'categories', fatal=False)
          if m_cat_container:
              category = self._html_search_regex(
                  r'(?s)<a[^<]+>(.*?)</a>', m_cat_container, 'category',
@@@ -1430,6 -1434,12 +1434,6 @@@ class YoutubeFeedsInfoExtractor(Youtube
              paging = mobj.group('paging')
          return self.playlist_result(feed_entries, playlist_title=self._PLAYLIST_TITLE)
  
 -class YoutubeSubscriptionsIE(YoutubeFeedsInfoExtractor):
 -    IE_DESC = u'YouTube.com subscriptions feed, "ytsubs" keyword (requires authentication)'
 -    _VALID_URL = r'https?://www\.youtube\.com/feed/subscriptions|:ytsubs(?:criptions)?'
 -    _FEED_NAME = 'subscriptions'
 -    _PLAYLIST_TITLE = u'Youtube Subscriptions'
 -
  class YoutubeRecommendedIE(YoutubeFeedsInfoExtractor):
      IE_DESC = u'YouTube.com recommended videos, "ytrec" keyword (requires authentication)'
      _VALID_URL = r'https?://www\.youtube\.com/feed/recommended|:ytrec(?:ommended)?'
@@@ -1462,43 -1472,6 +1466,43 @@@ class YoutubeFavouritesIE(YoutubeBaseIn
          return self.url_result(playlist_id, 'YoutubePlaylist')
  
  
 +class YoutubeSubscriptionsIE(YoutubePlaylistIE):
 +    IE_NAME = u'youtube:subscriptions'
 +    IE_DESC = u'YouTube.com subscriptions feed, "ytsubs" keyword (requires authentication)'
 +    _VALID_URL = r'https?://www\.youtube\.com/feed/subscriptions|:ytsubs(?:criptions)?'
 +
 +    def _real_extract(self, url):
 +        title = u'Youtube Subscriptions'
 +        page = self._download_webpage('https://www.youtube.com/feed/subscriptions', title)
 +
 +        # The extraction process is the same as for playlists, but the regex
 +        # for the video ids doesn't contain an index
 +        ids = []
 +        more_widget_html = content_html = page
 +
 +        for page_num in itertools.count(1):
 +            matches = re.findall(r'href="\s*/watch\?v=([0-9A-Za-z_-]{11})', content_html)
 +            new_ids = orderedSet(matches)
 +            ids.extend(new_ids)
 +
 +            mobj = re.search(r'data-uix-load-more-href="/?(?P<more>[^"]+)"', more_widget_html)
 +            if not mobj:
 +                break
 +
 +            more = self._download_json(
 +                'https://youtube.com/%s' % mobj.group('more'), title,
 +                'Downloading page #%s' % page_num,
 +                transform_source=uppercase_escape)
 +            content_html = more['content_html']
 +            more_widget_html = more['load_more_widget_html']
 +
 +        return {
 +            '_type': 'playlist',
 +            'title': title,
 +            'entries': self._ids_to_results(ids),
 +        }
 +
 +
  class YoutubeTruncatedURLIE(InfoExtractor):
      IE_NAME = 'youtube:truncated_url'
      IE_DESC = False  # Do not list