aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Sewell <me@willsewell.name>2014-11-21 23:16:12 +0000
committerWill Sewell <me@willsewell.name>2014-11-21 23:16:12 +0000
commite1e8b6897b2e2610c45eb53fe44e1e07c3c39e82 (patch)
treed0472def35cf581e88e7b6cdae32377850838553
parent53d1cd1f779201af426548fc77e1724b6c70abd9 (diff)
[vk.com] Updated the extract_videos_from_page function with a much simpler 1-liner.
-rw-r--r--youtube_dl/extractor/vk.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/youtube_dl/extractor/vk.py b/youtube_dl/extractor/vk.py
index 7136a0cb2..e8d7cdeae 100644
--- a/youtube_dl/extractor/vk.py
+++ b/youtube_dl/extractor/vk.py
@@ -11,7 +11,8 @@ from ..utils import (
compat_urllib_parse,
compat_str,
unescapeHTML,
- unified_strdate)
+ unified_strdate,
+ orderedSet)
class VKIE(InfoExtractor):
@@ -216,13 +217,6 @@ class VKUserVideosIE(InfoExtractor):
'playlist_mincount': 4,
}
- def extract_videos_from_page(self, page):
- ids_in_page = []
- for mobj in re.finditer(r'href="/video([0-9_]+)"', page):
- if mobj.group(1) not in ids_in_page:
- ids_in_page.append(mobj.group(1))
- return ids_in_page
-
def _real_extract(self, url):
# Extract page id
mobj = re.match(self._VALID_URL, url)
@@ -232,7 +226,7 @@ class VKUserVideosIE(InfoExtractor):
# Download page and get video ids
page_id = mobj.group(1)
page = self._download_webpage(url, page_id)
- video_ids = self.extract_videos_from_page(page)
+ video_ids = orderedSet(m.group(1) for m in re.finditer(r'href="/video([0-9_]+)"', page))
self._downloader.to_screen('[vk] User videos %s: Found %i videos' % (page_id, len(video_ids)))