replaced tabs with spaces in moviestorm IE
This commit is contained in:
parent
8654a8484f
commit
0dc602d9e3
@ -56,13 +56,13 @@ class MovieStormIE(InfoExtractor):
|
|||||||
_VALID_URL = r'http://moviestorm\.eu/view/(\d+)-watch-(.*)/season-(\d+)/episode-(\d+)'
|
_VALID_URL = r'http://moviestorm\.eu/view/(\d+)-watch-(.*)/season-(\d+)/episode-(\d+)'
|
||||||
_LINK_FARM = True
|
_LINK_FARM = True
|
||||||
|
|
||||||
# There are no tests for this IE because the links on any given moviestorm
|
# There are no tests for this IE because the links on any given moviestorm
|
||||||
# page can dynamically change, and because the actual download/extraction
|
# page can dynamically change, and because the actual download/extraction
|
||||||
# is ultimately preformed by another IE. An example of an acceptable url to
|
# is ultimately preformed by another IE. An example of an acceptable url to
|
||||||
# feed to this IE is: http://moviestorm.eu/view/218-watch-the-simpsons/season-26/episode-1
|
# feed to this IE is: http://moviestorm.eu/view/218-watch-the-simpsons/season-26/episode-1
|
||||||
_TEST = False
|
_TEST = False
|
||||||
|
|
||||||
# moviestorm's drupal db config is unstable at times
|
# moviestorm's drupal db config is unstable at times
|
||||||
# retry up to 5 times before giving up, 5 second delay
|
# retry up to 5 times before giving up, 5 second delay
|
||||||
# between each retry
|
# between each retry
|
||||||
retry_count = 0
|
retry_count = 0
|
||||||
@ -79,12 +79,12 @@ class MovieStormIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
# retry loop to capture moviestorm page
|
# retry loop to capture moviestorm page
|
||||||
while True:
|
while True:
|
||||||
if self.retry_count == 0:
|
if self.retry_count == 0:
|
||||||
note = 'Downloading link farm page'
|
note = 'Downloading link farm page'
|
||||||
else:
|
else:
|
||||||
note = ('Unstable db connection, retying again in %s seconds '
|
note = ('Unstable db connection, retying again in %s seconds '
|
||||||
'[%s/%s]' % (self.retry_wait, self.retry_count,
|
'[%s/%s]' % (self.retry_wait, self.retry_count,
|
||||||
self.max_retries))
|
self.max_retries))
|
||||||
|
|
||||||
(_, _, token) = self._parse_target(url)
|
(_, _, token) = self._parse_target(url)
|
||||||
farmpage = self._download_webpage(
|
farmpage = self._download_webpage(
|
||||||
@ -95,14 +95,14 @@ class MovieStormIE(InfoExtractor):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if farmpage.strip() != 'MySQL server has gone away':
|
if farmpage.strip() != 'MySQL server has gone away':
|
||||||
break
|
break
|
||||||
|
|
||||||
if self.retry_count < self.max_retries:
|
if self.retry_count < self.max_retries:
|
||||||
self.retry_count += 1
|
self.retry_count += 1
|
||||||
sleep(self.retry_wait)
|
sleep(self.retry_wait)
|
||||||
else:
|
else:
|
||||||
msg = 'The moviestorm database is currently unstable. Please try again later.'
|
msg = 'The moviestorm database is currently unstable. Please try again later.'
|
||||||
raise ExtractorError(msg, expected=True)
|
raise ExtractorError(msg, expected=True)
|
||||||
|
|
||||||
# scrape WATCH button links from moviestorm page
|
# scrape WATCH button links from moviestorm page
|
||||||
self.to_screen(': Extracting watch page urls')
|
self.to_screen(': Extracting watch page urls')
|
||||||
@ -111,18 +111,18 @@ class MovieStormIE(InfoExtractor):
|
|||||||
# get direct urls from scraped watch pages
|
# get direct urls from scraped watch pages
|
||||||
self.to_screen(': Extracting direct links from watch pages')
|
self.to_screen(': Extracting direct links from watch pages')
|
||||||
for watch_url in watch_urls:
|
for watch_url in watch_urls:
|
||||||
(_, _, token) = self._parse_target(watch_url)
|
(_, _, token) = self._parse_target(watch_url)
|
||||||
watchpage = self._download_webpage(
|
watchpage = self._download_webpage(
|
||||||
watch_url, token,
|
watch_url, token,
|
||||||
note=False,
|
note=False,
|
||||||
errnote='Unable to download link farm watch page',
|
errnote='Unable to download link farm watch page',
|
||||||
fatal=False
|
fatal=False
|
||||||
)
|
)
|
||||||
|
|
||||||
if watchpage is not None:
|
if watchpage is not None:
|
||||||
direct_url = MovieStormHTMLParser.extract_direct_url(watchpage)
|
direct_url = MovieStormHTMLParser.extract_direct_url(watchpage)
|
||||||
if direct_url:
|
if direct_url:
|
||||||
self.direct_urls.append(direct_url)
|
self.direct_urls.append(direct_url)
|
||||||
|
|
||||||
self.to_screen(': Passing off farmed links to InfoExtractors')
|
self.to_screen(': Passing off farmed links to InfoExtractors')
|
||||||
return list(set(self.direct_urls))
|
return list(set(self.direct_urls))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user