Use a helper method to replace a messy regex

This commit is contained in:
SpiderRider067 2020-12-30 21:59:27 -05:00 committed by GitHub
parent 6ce7baecaa
commit 14834bf977
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,8 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import get_elements_by_class
class TASVideosIE(InfoExtractor): class TASVideosIE(InfoExtractor):
_VALID_URL = r'http://tasvideos.org/(?P<id>\d+M)\.html' _VALID_URL = r'http://tasvideos.org/(?P<id>\d+M)\.html'
@ -57,8 +59,8 @@ class TASVideosPlaylistIE(InfoExtractor):
webpage = self._download_webpage(url, playlist_id) webpage = self._download_webpage(url, playlist_id)
playlist_title = self._search_regex( playlist_title = self._search_regex(
r'<title>(?P<title>[^<]*)</title>', webpage, 'title') r'<title>(?P<title>[^<]*)</title>', webpage, 'title')
video_entries = re.findall( video_entries = get_elements_by_class('item', webpage)
r'((?s)<table class="item".*?archive.*?<\/table)>', webpage)
entries = [] entries = []
for entry in video_entries: for entry in video_entries:
video_urls = re.findall( video_urls = re.findall(