dandygithub / kodi

KODI Addons Project
GNU General Public License v3.0
75 stars 48 forks source link

Fixed requesting stream with is_director param #49

Closed ffoxin closed 3 years ago

ffoxin commented 3 years ago

Hello Some movies with director cut streams are not accessible: server responses with the error {'success': False, 'message': 'Время сессии истекло. Пожалуйста, обновите страницу и повторите попытку'}

After some investigation, I'd found that it happens because of the missing parameter "is_director" in the request. Default behavior (with the error):

    with Session() as session:
        response = session.post(
            'https://hdrezka.sh/ajax/get_cdn_series/',
            cookies={
                "dle_user_token": "64db22de57884b11f90a5c74c0637a5c",
                "PHPSESSID": "ag2dm7q3klj3cdupf1loaerc93"
            },
            data={
                'action': 'get_movie',
                'id': u'2930',
                'translator_id': u'111',
            },
            headers={
                'Origin': 'http://hdrezka.sh',
                'X-Requested-With': 'XMLHttpRequest',
                'Host': 'hdrezka.sh',
                'Referer': 'https://hdrezka.sh/films/fiction/2930-hraniteli-2009.html',
                'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0',
            }
        )

        print(response.json())

Correct request (no error):

    with Session() as session:
        data = {
            'id': '2930',
            'translator_id': '111',
            # 'is_camrip': '0',
            # 'is_ads': '0',
            'is_director': '1',
            'action': 'get_movie'
        }

        response = session.post(
            'https://hdrezka.sh/ajax/get_cdn_series/',
            headers={
                'Origin': 'http://hdrezka.sh',
                'X-Requested-With': 'XMLHttpRequest',
                'Host': 'hdrezka.sh',
                'Referer': 'https://hdrezka.sh/films/fiction/2930-hraniteli-2009.html',
                'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0',
            },
            data=data,
        )

        print(response.json())

There are also 2 more extra params allowed: is_camrip and is_ads. I haven't checked it hence no changes with it in the code.