mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 03:03:01 +00:00
[letv] Simplify
This commit is contained in:
parent
8faf9b9b41
commit
265bfa2c79
1 changed files with 14 additions and 8 deletions
|
@ -1,14 +1,20 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os.path
|
import datetime
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import datetime
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (compat_urlparse, compat_urllib_parse)
|
from ..compat import (
|
||||||
from ..utils import (ExtractorError, parse_iso8601)
|
compat_urlparse,
|
||||||
|
compat_urllib_parse,
|
||||||
|
)
|
||||||
|
from ..utils import (
|
||||||
|
determine_ext,
|
||||||
|
ExtractorError,
|
||||||
|
parse_iso8601,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class LetvIE(InfoExtractor):
|
class LetvIE(InfoExtractor):
|
||||||
|
@ -44,7 +50,7 @@ class LetvIE(InfoExtractor):
|
||||||
def urshift(val, n):
|
def urshift(val, n):
|
||||||
return val >> n if val >= 0 else (val + 0x100000000) >> n
|
return val >> n if val >= 0 else (val + 0x100000000) >> n
|
||||||
|
|
||||||
# ror() and calcTimeKey() are reversed from a embedded swf file in KLetvPlayer.swf
|
# ror() and calc_time_key() are reversed from a embedded swf file in KLetvPlayer.swf
|
||||||
def ror(self, param1, param2):
|
def ror(self, param1, param2):
|
||||||
_loc3_ = 0
|
_loc3_ = 0
|
||||||
while _loc3_ < param2:
|
while _loc3_ < param2:
|
||||||
|
@ -52,7 +58,7 @@ def ror(self, param1, param2):
|
||||||
_loc3_ += 1
|
_loc3_ += 1
|
||||||
return param1
|
return param1
|
||||||
|
|
||||||
def calcTimeKey(self, param1):
|
def calc_time_key(self, param1):
|
||||||
_loc2_ = 773625421
|
_loc2_ = 773625421
|
||||||
_loc3_ = self.ror(param1, _loc2_ % 13)
|
_loc3_ = self.ror(param1, _loc2_ % 13)
|
||||||
_loc3_ = _loc3_ ^ _loc2_
|
_loc3_ = _loc3_ ^ _loc2_
|
||||||
|
@ -67,7 +73,7 @@ def _real_extract(self, url):
|
||||||
'platid': 1,
|
'platid': 1,
|
||||||
'splatid': 101,
|
'splatid': 101,
|
||||||
'format': 1,
|
'format': 1,
|
||||||
'tkey': self.calcTimeKey(int(time.time())),
|
'tkey': self.calc_time_key(int(time.time())),
|
||||||
'domain': 'www.letv.com'
|
'domain': 'www.letv.com'
|
||||||
}
|
}
|
||||||
play_json = self._download_json(
|
play_json = self._download_json(
|
||||||
|
@ -108,7 +114,7 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
url_info_dict = {
|
url_info_dict = {
|
||||||
'url': media_url,
|
'url': media_url,
|
||||||
'ext': os.path.splitext(dispatch[format_id][1])[1][1:]
|
'ext': determine_ext(dispatch[format_id][1])
|
||||||
}
|
}
|
||||||
|
|
||||||
if format_id[-1:] == 'p':
|
if format_id[-1:] == 'p':
|
||||||
|
|
Loading…
Reference in a new issue