Compare commits

..

4 Commits

Author SHA1 Message Date
naginatana
9679654fe9
Update tudou.py 2023-10-01 14:50:05 +08:00
naginatana
36fe8b2130
Update tudou.py 2023-10-01 14:47:18 +08:00
naginatana
1c3df1b9b6
Update tudou.py 2023-10-01 14:44:57 +08:00
naginatana
d1cbb3cfc8
Update tudou.py 2023-10-01 14:42:38 +08:00

View File

@ -1,4 +1,6 @@
from .common import InfoExtractor from .common import InfoExtractor
import time
import re
class TudouIE(InfoExtractor): class TudouIE(InfoExtractor):
@ -26,24 +28,29 @@ class TudouIE(InfoExtractor):
title = data['data']['data']['data']['extra']['videoTitle'] title = data['data']['data']['data']['extra']['videoTitle']
show_name = data['data']['data']['data']['extra']['showName'] show_name = data['data']['data']['data']['extra']['showName']
_, urlh = self._download_webpage_handle(
"https://log.mmstat.com/yt.gif", video_id, 'Retrieving cna info'
)
re_cna = re.compile(r'cna=([\w\W]+; expires)')
cna = re.findall(re_cna, urlh.headers['set-cookie'])[0].replace("; expires", "")
ts1 = time.time() * 1000
# About params1{} (sometimes they call it querystring?)
# IS there a way to know which value is essential to make the request work?
params1 = { params1 = {
"vid": "XNjAwMjk3Nzk1Mg==", "vid": video_id,
# "play_ability": "16782592",
# "current_showid": "590457",
# "preferClarity": "2",
"ccode": "050F", "ccode": "050F",
"client_ip": "192.168.1.1", "client_ip": "192.168.1.1",
"utid": "bIeZHQHll0oCAXj0ME8oOTqH", "utid": cna,
"client_ts": "1695807088", "client_ts": ts1,
"ckey": "140#XvSoigEEzzPw6zo2K5XTwpN8s9xI9h7FQeSkq6lrpeQ3Qm8xyFnPG9Uxtq6aSBxXVXwkqv6L4/GKvKzgD5oqlbzxhQfIlJgkzFnb0OK7lpTzzPzbVXlqlbrofJH+V3hqabzi228++bP0EHmiuZsHofFc74upoC6MkpscNHvXzJK+//Wna4Zt+dTHiQWqckfMQdZWTBs1ZpU/wadIq8nYxy5uZ+cRepqZMra+XLkaqMgGBcF/Ie/igRJDCcHl4d28aId7B+XOW/V6+gN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DmiufcPHd7sUG/A0RYx3pHQ9wYa3lQS3MjIjWejRlGzQdt0fxqEhcHuu10zfo4lhobcXARy7rDT2fb6wJrCHf98c0l8iGiOTSXVZVvWiQMM1est+EACvaMFB/baJm1BjCMKeS2zQEgUkRmulz00icM/W0BS8sEOR1RpOP4WXpji1HjEDpt2MTVHGqUwo223u03IGTHK3Z+Ki1ujWXKKUP+E1VESmBF0rzBkR/dyP20hRbGSpfX7eRVABF6npnWgdgjzQB4FOxAjHPn5CupypFZDYIdKyfQyC45mGS5WI6Wz9JmoFjxO7ikUKKP6p0KP3nj+5YTtbwUNpciVhD+mOZZKq6+dT6G7cfBhOzZQFXs66gZ3174KWt6sLTcvLzEezfoA0mO0NIx0mZZlL1lYonycOtcByLpKmSW5Xd96FWP5fuenIBUUJZCectNPgB/nFNGpeZuhruYbBbG843gwtfiXaRp2r4ssDM07/pPsEfk6MzcmtAxIimwdRjv6lSx+QSEANWRazykZneHEpH1R0uB0BjJdozYDKK84KMsNd+jjg6XTz9Ai0KZYMUJXN1Vz=",
"vip": "0", "vip": "0",
# "callback": "", # youkuPlayer_call_1695807088862 # "callback": "", # youkuPlayer_call_1695807088862
"_t": "08847696931775378" # "_t": "08847696931775378"
} }
headers1 = { headers1 = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/117.0", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/117.0",
# "cookie": "",
"Referer": "https://play.tudou.com/" "Referer": "https://play.tudou.com/"
} }
@ -53,12 +60,6 @@ class TudouIE(InfoExtractor):
# I'm not sure what cdn_url stands for, but it also delivers the full video # I'm not sure what cdn_url stands for, but it also delivers the full video
# I'll put the cdn_url here for now, if needed I can replace it with m3u8_url # I'll put the cdn_url here for now, if needed I can replace it with m3u8_url
# I probably need to do a bit more on stuff like cookies, to pass the authentication, I wonder how those values are calculated # I probably need to do a bit more on stuff like cookies, to pass the authentication, I wonder how those values are calculated
# And about params1{} in line 32 (sometimes they call it querystring?)
# IS there a way to know which value is essential for the request process below?
# Maybe I can just leave it, it works anyway.
# But I still want to simplify it, it's a bit too long.
data_m3u8 = self._download_json( data_m3u8 = self._download_json(
'https://ups.youku.com/ups/get.json', video_id, 'https://ups.youku.com/ups/get.json', video_id,
'Downloading JSON metadata', 'Downloading JSON metadata',