LaMP57 / BilibiliMangaDownload

bilibili漫画下载
66 stars 3 forks source link

Temporary locked episode #13

Open bumbaras opened 2 years ago

bumbaras commented 2 years ago

Is it possible to fetch episode which is temporary locked? pay_mode = 1 and message is "need buy episode". GetImageIndex offers only 2 frames (first and last). In bilibili app the lock is divided on 5 tiers, each one has different time of unlocking, from 5 minutes to 24 hours. I could analyze how it works directly under browser but I can't because scripts on page block browser to open few last chapters no matter it is temporary locked or not. Webapp just directs user to android application.

lhz07 commented 2 years ago

Is it possible to fetch episode which is temporary locked? pay_mode = 1 and message is "need buy episode". GetImageIndex offers only 2 frames (first and last). In bilibili app the lock is divided on 5 tiers, each one has different time of unlocking, from 5 minutes to 24 hours. I could analyze how it works directly under browser but I can't because scripts on page block browser to open few last chapters no matter it is temporary locked or not. Webapp just directs user to android application.

What is the episode that is temporary locked? It seems that GetImageIndex offers only 2 frames (first and last) for all episodes that are needed to pay. Second, could you please illustrate "the lock is divided on 5 tiers" more detailedly?

bumbaras commented 2 years ago

It's bilibilicomics world wide version. It's similar in methods to chinese version but GetImageIndex operates differently. I already made a modification to download free episodes from it but stuck on time locked episodes. For now english versions of comics are not paywalled but the free episodes are limited to some numbers then timewall enters into action. Timewall is divided on 5 parts, called tiers. First tier You can open immediately. Next - 5 minutes wait. Then 30 minutes. Last tier is 24h cool down.

lhz07 commented 2 years ago

I visited the website of bilibili comics just now. So what do you want to do? When the episode is unloked, it is possible to request it. For the episode that is temporary locked, it may be impossible to get it, just like the paywalled episodes. However, you can make a program that can automatically activate the timewall, and wait for it unlocked, then download that episode.

bumbaras commented 2 years ago

For now i stopped at authentication issue. I am too newbe to create interface for login/logout mechanism. I tried to add sending proper cookies got from Mozilla Firefox when I am logged into BiliBili but this didn't work. No matter what I have done to requests, what header i have sent server always treats python requests calls as ones made by unauthenticated user. Without signed in, You can't pass the timewall, and the timewall is permament - it will never go away - user needs to activate tier to read the chapter. Interesting is if You can fetch proper index.dat where all pages are in place, You can use such index.dat to fetch all pages without the need to be logged in site. But getting complete index.dat seems is not possible for unauthenticated user.

lhz07 commented 2 years ago

In Chinese bilibili manga, just providing SESSDATA can finish identity authentication. I don't know how it works on worldwide bilibili manga. However, I will try to find it after finishing my recent exams. If getting cookies from Mozilla Firefox is impossible, Just try copying the request and paste on https://curlconverter.com/ ,it can help you construct the code in Python.

bumbaras commented 2 years ago

Seems worldwide bilibili doesn't use SESSDATA, at least i don't see such key in cookies for bilibili. There is no problem getting current key pairs for bilibili cookie from Firefox, it's just it doesn't allow to authenticate user. Curlconverter seems interesting, will look at it.

lhz07 commented 2 years ago

World wide bilibili use 'access_token', it is a dynamic value. When you refresh the page, it changes. And the expire time is rather short. image image

lhz07 commented 2 years ago

I have found the problem!!! When you request, bilibili worldwide manga needs not only cookies, but also headers. And the most important element in headers is "authorization", which is closely connected to the "access token". Once the cookies and headers are right, you will get what you want!

lhz07 commented 2 years ago

I use selenium to automatically login and get cookies, then construct a request(get credential) with cookies, headers, params, json_data. It works!

lhz07 commented 2 years ago

See this video. This is an example.https://greatgoogle-my.sharepoint.com/:v:/g/personal/lhz_greatgoogle_onmicrosoft_com/Edq6qlACT89AtCW1K8MJomUBiZ4zu3Bm4J8QlixQBpAHpg?e=G2e7qS

bumbaras commented 2 years ago

I saw Your video. Maybe i created additional issue trying to preserve login with google authorization, not log in by user and password. I need them first to use standard authentication.