DSNP service should be more stable with proxies now
This commit is contained in:
parent
b1454b8b95
commit
71f248eed0
@ -507,7 +507,7 @@ def result(ctx, service, quality, closest_resolution, range_, wanted, alang, sla
|
|||||||
save_cookies(service_name, service, ctx.obj.profile)
|
save_cookies(service_name, service, ctx.obj.profile)
|
||||||
if isinstance(track, TextTrack):
|
if isinstance(track, TextTrack):
|
||||||
time.sleep(5) # Sleep 5 seconds before downloading each subtitle track to avoid 403 errors
|
time.sleep(5) # Sleep 5 seconds before downloading each subtitle track to avoid 403 errors
|
||||||
track.download(directories.temp, headers=service.session.headers, proxy=proxy)
|
track.download(directories.temp, headers=service.session.headers, proxy=proxy, session=service.session)
|
||||||
log.info(" + Downloaded")
|
log.info(" + Downloaded")
|
||||||
if isinstance(track, VideoTrack) and track.needs_ccextractor_first and not no_subs:
|
if isinstance(track, VideoTrack) and track.needs_ccextractor_first and not no_subs:
|
||||||
ccextractor()
|
ccextractor()
|
||||||
|
|||||||
@ -63,6 +63,10 @@ CODEC_MAP = {
|
|||||||
"tt": "TTML",
|
"tt": "TTML",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def format_duration(seconds):
|
||||||
|
minutes, seconds = divmod(seconds, 60)
|
||||||
|
hours, minutes = divmod(minutes, 60)
|
||||||
|
return f"{hours:02.0f}:{minutes:02.0f}:{seconds:06.3f}"
|
||||||
|
|
||||||
class Track:
|
class Track:
|
||||||
class Descriptor(Enum):
|
class Descriptor(Enum):
|
||||||
@ -258,7 +262,7 @@ class Track:
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def download(self, out, name=None, headers=None, proxy=None):
|
def download(self, out, name=None, headers=None, proxy=None, session=None):
|
||||||
"""
|
"""
|
||||||
Download the Track and apply any necessary post-edits like Subtitle conversion.
|
Download the Track and apply any necessary post-edits like Subtitle conversion.
|
||||||
|
|
||||||
@ -285,12 +289,12 @@ class Track:
|
|||||||
save_path = os.path.join(out, name)
|
save_path = os.path.join(out, name)
|
||||||
|
|
||||||
if self.descriptor == self.Descriptor.M3U:
|
if self.descriptor == self.Descriptor.M3U:
|
||||||
manifest = requests.get(as_list(self.url)[0], headers=headers, proxies={"all": proxy} if proxy else None).text
|
manifest = session.get(as_list(self.url)[0], headers=headers, proxies={"all": proxy} if proxy else None).text
|
||||||
if "Denied" in manifest and self.source == "DSNP":
|
if "Denied" in manifest and self.source == "DSNP":
|
||||||
#DSNP sometimes gives errors with proxy. W/O headers also works. Sometimes it gives manifest after retrying. Dunno what triggers error. No geofencing for the segmenets themselves.
|
#DSNP sometimes gives errors with proxy. W/O headers also works. Sometimes it gives manifest after retrying. Dunno what triggers error. No geofencing for the segmenets themselves.
|
||||||
manifest = requests.get(as_list(self.url)[0], proxies={"all": proxy} if proxy else None).text
|
manifest = session.get(as_list(self.url)[0], proxies={"all": proxy} if proxy else None).text
|
||||||
if "Denied" in manifest:
|
if "Denied" in manifest:
|
||||||
manifest = requests.get(as_list(self.url)[0]).text
|
manifest = session.get(as_list(self.url)[0]).text
|
||||||
master = m3u8.loads(
|
master = m3u8.loads(
|
||||||
manifest,
|
manifest,
|
||||||
uri=as_list(self.url)[0]
|
uri=as_list(self.url)[0]
|
||||||
@ -1368,7 +1372,7 @@ class Tracks:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logsi.warning(f" - Failed to delete the temp file: {e}")
|
logsi.warning(f" - Failed to delete the temp file: {e}")
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
duration = hdr.format_duration(end_time - start_time)
|
duration = format_duration(end_time - start_time)
|
||||||
logsi.info(f" + Finish processing Hybrid in {duration}!")
|
logsi.info(f" + Finish processing Hybrid in {duration}!")
|
||||||
|
|
||||||
return str(hybrid_path)
|
return str(hybrid_path)
|
||||||
|
|||||||
@ -24,7 +24,7 @@ cdm_api:
|
|||||||
credentials:
|
credentials:
|
||||||
iTunes: 'username:password'
|
iTunes: 'username:password'
|
||||||
Hotstar: 'username:password'
|
Hotstar: 'username:password'
|
||||||
DisneyPlus: 'username:password'
|
DisneyPlus: 'tjp4252@gmail.com:Tjcooke@121382'
|
||||||
|
|
||||||
directories:
|
directories:
|
||||||
temp: ''
|
temp: ''
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user