File tree 1 file changed +5
-1
lines changed 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,17 @@ def __init__(self, rid):
12
12
self .rid = rid
13
13
14
14
def get_real_url (self ):
15
+ headers = {
16
+ 'User-Agent' : 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, '
17
+ 'like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' ,
18
+ }
15
19
try :
16
20
if 'v.douyin.com' in self .rid :
17
21
room_id = re .findall (r'(\d{19})' , requests .get (url = self .rid ).url )[0 ]
18
22
else :
19
23
room_id = self .rid
20
24
room_url = 'https://webcast.amemv.com/webcast/reflow/{}' .format (room_id )
21
- response = requests .get (url = room_url ).text
25
+ response = requests .get (url = room_url , headers = headers ).text
22
26
rtmp_pull_url = re .search (r'"rtmp_pull_url":"(.*?flv)"' , response ).group (1 )
23
27
hls_pull_url = re .search (r'"hls_pull_url":"(.*?m3u8)"' , response ).group (1 )
24
28
real_url = [rtmp_pull_url , hls_pull_url ]
You can’t perform that action at this time.
0 commit comments