@ -49,7 +49,7 @@ class TikTokBaseIE(InfoExtractor):
def _call_api_impl ( self , ep , query , manifest_app_version , video_id , fatal = True ,
def _call_api_impl ( self , ep , query , manifest_app_version , video_id , fatal = True ,
note = ' Downloading API JSON ' , errnote = ' Unable to download API page ' ) :
note = ' Downloading API JSON ' , errnote = ' Unable to download API page ' ) :
self . _set_cookie ( self . _API_HOSTNAME , ' odin_tt ' , ' ' . join ( random . choice ( ' 0123456789abcdef ' ) for _ in range ( 160 ) ) )
self . _set_cookie ( self . _API_HOSTNAME , ' odin_tt ' , ' ' . join ( random . choice s ( ' 0123456789abcdef ' , k = 160 ) ) )
webpage_cookies = self . _get_cookies ( self . _WEBPAGE_HOST )
webpage_cookies = self . _get_cookies ( self . _WEBPAGE_HOST )
if webpage_cookies . get ( ' sid_tt ' ) :
if webpage_cookies . get ( ' sid_tt ' ) :
self . _set_cookie ( self . _API_HOSTNAME , ' sid_tt ' , webpage_cookies [ ' sid_tt ' ] . value )
self . _set_cookie ( self . _API_HOSTNAME , ' sid_tt ' , webpage_cookies [ ' sid_tt ' ] . value )
@ -68,8 +68,8 @@ class TikTokBaseIE(InfoExtractor):
' build_number ' : app_version ,
' build_number ' : app_version ,
' manifest_version_code ' : manifest_app_version ,
' manifest_version_code ' : manifest_app_version ,
' update_version_code ' : manifest_app_version ,
' update_version_code ' : manifest_app_version ,
' openudid ' : ' ' . join ( random . choice ( ' 0123456789abcdef ' ) for _ in range ( 16 ) ) ,
' openudid ' : ' ' . join ( random . choice s ( ' 0123456789abcdef ' , k = 16 ) ) ,
' uuid ' : ' ' . join ( [ random . choice ( string . digits ) for _ in range ( 16 ) ] ) ,
' uuid ' : ' ' . join ( random . choice s ( string . digits , k = 16 ) ) ,
' _rticket ' : int ( time . time ( ) * 1000 ) ,
' _rticket ' : int ( time . time ( ) * 1000 ) ,
' ts ' : int ( time . time ( ) ) ,
' ts ' : int ( time . time ( ) ) ,
' device_brand ' : ' Google ' ,
' device_brand ' : ' Google ' ,
@ -638,7 +638,7 @@ class TikTokUserIE(TikTokBaseIE):
' max_cursor ' : 0 ,
' max_cursor ' : 0 ,
' min_cursor ' : 0 ,
' min_cursor ' : 0 ,
' retry_type ' : ' no_retry ' ,
' retry_type ' : ' no_retry ' ,
' device_id ' : ' ' . join ( random . choice ( string . digits ) for _ in range ( 19 ) ) , # Some endpoints don't like randomized device_id, so it isn't directly set in _call_api.
' device_id ' : ' ' . join ( random . choice s ( string . digits , k = 19 ) ) , # Some endpoints don't like randomized device_id, so it isn't directly set in _call_api.
}
}
for page in itertools . count ( 1 ) :
for page in itertools . count ( 1 ) :
@ -686,7 +686,7 @@ class TikTokBaseListIE(TikTokBaseIE): # XXX: Conventionally, base classes shoul
' cursor ' : 0 ,
' cursor ' : 0 ,
' count ' : 20 ,
' count ' : 20 ,
' type ' : 5 ,
' type ' : 5 ,
' device_id ' : ' ' . join ( random . choice ( string . digits ) for i in range ( 19 ) )
' device_id ' : ' ' . join ( random . choice s ( string . digits , k = 19 ) )
}
}
for page in itertools . count ( 1 ) :
for page in itertools . count ( 1 ) :