Code Monkey home page Code Monkey logo

pyhulu's Introduction

pyhulu

Build Status License: GPL v3

Python library for interacting with the E2E encrypted Hulu API

Usage

First, initialize the HuluClient class with a device code, device key, and cookies:

client = pyhulu.HuluClient(device_code, device_key, cookies)

device_code is a three-digit string or integer (doesn't matter) denoting the device you will make requests as.

device_key is a 16-byte AES key that corresponds to the device code you're using. This is used to decrypt the device config response.

cookies can either be a cookie jar object or a dict of cookie key / value pairs. This is passed to the requests library, so whatever it takes will work. Examples here: http://docs.python-requests.org/en/master/user/quickstart/#cookies.

With the initialized client object, you can use the load_playlist() method:

client.load_playlist(video_id)

video_id is either a string or integer denoting the video ID to request a playlist for. This is NOT the ID in the /watch/ URL! If you view the page source of a /watch/ page, you'll find \"content_id\" which has the actual video ID used by the API.

This method returns a dict of the playlist response, which contains stream and license URLs.

Device Codes and Keys

PC

  • Device code: 159
  • Device key (hex): 6ebfc84f3c304217b20fd9a66cb5957f

Example Code

import pyhulu
from http.cookiejar import MozillaCookieJar

cj = MozillaCookieJar('cookies.txt')
cj.load()

client = pyhulu.HuluClient('159', bytes.fromhex('6ebfc84f3c304217b20fd9a66cb5957f'), cj)
print(client.load_playlist(61085964))

Installation

To install, either clone the repository and run python setup.py install or run pip install pyhulu.

To-Do

  • Add unit tests
  • Add to PyPI
  • Add documentation

pyhulu's People

Contributors

qtlunya avatar truedread avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.