semvec/pypi-packages huggingface dataset:
pym3u8 0.1.5
Simple Python 3 lib for downloading online HLS streams and videos
License: MIT
Keywords: M3U8,HLS,STREAM,VIDEO

# pym3u8

**pym3u8** is simple Python 3 lib for downloading online HLS streams and videos. 

You need only link to m3u8 file with list of ts-files.

pym3u8 working with direct connections and socks proxies.

## Installation
Install with pip:
```
pip install pym3u8
```

Or download source or clone repository and execute:
```
pip3 install git+https://github.com/ndrwpvlv/pym3u8.git
```
If you have some permissions errors try this one:
```
sudo -H pip3 install git+https://github.com/ndrwpvlv/pym3u8.git
```

## Basic usage from cli
Basic usage from command line
```
python3 -m pym3u8 [-h] [-u URL] [-r REFERER] [-f FILENAME] [-e EXTENSION]
              [-a USER_AGENT] [-p PROXY] [-m M3U8_EXT] [-s]

optional arguments:
  -h, --help            show this help message and exit
  -u URL, --url URL     Url of m3u8
  -r REFERER, --referer REFERER
                        Referer url
  -f FILENAME, --filename FILENAME
                        File name for downloading
  -e EXTENSION, --extension EXTENSION
                        Extension of file for downloading
  -a USER_AGENT, --user_agent USER_AGENT
                        User-agent string
  -p PROXY, --proxy PROXY
                        Proxy url
  -m M3U8_EXT, --m3u8_ext M3U8_EXT
                        Custom m3u8 extension
  -s, --ssl_verify      Verify ssl certificates

```
Example:
```
python3 -m pym3u8 -u "https://example.com/hls/videos/000000/00/000000000/,720P_4000K,480P_2000K,240P_400K,_000000000.mp4.urlset/index-f1-v1-a1.m3u8" -p "socks5://127.0.0.1:1080"
```

## Basic usage from macros
```
from pym3u8 import Loader

url = 'https://example.com/videos/ts/0000/0001/playlist.m3u8'
referer = ''
proxy = 'socks5://127.0.0.1:1080'
filename = 'stream'
extension = 'ts'
user_agent='ExampleUA/0.0.1'

loader = Loader(url, referer, proxy=proxy, filename=filename, extension=extension, user_agent=user_agent)
loader.download()
``` 
## Requirements
```
Python 3.6+

certifi==2019.11.28
chardet==3.0.4
idna==2.8
PySocks==1.7.1
requests==2.22.0
socks==0
urllib3==1.25.8
```
bitjoy 1.1
Bit, Bytes and Logical Gates Abstraction.
License: MIT
Keywords: bitjoy,bit,bytes,logical-operators,int_to_bytes,half-adder,full-adder,boolean,gates,abstraction

# BitJoy
Bit, Bytes and Logical Gates Abstraction.

## About
Repository to 'Padrões de Projeto' subject at university. A height level Bit/Bytes and logical circuits abstractions.  
Also Udacity Machine Learning Engineer Nanodegre program to add these package to PyPi.

## Usage
### Installing
```sh
pip install bitjoy
```
### Starting with Bit
Importing and instantiating Bit class.
```python
from bitjoy.dtypes import Bit

zero = Bit(0)
# ZeroBit(0)
one = Bit(1)
# OneBit(1)
```
Creating a bit passing `0` in the `__init__` method, it will create another class: `ZeroBit`. The same away, passing `1`, it will create a `OneBit`.

### Logical Gates
There is also support to logical operators (called logical gates or logical circuits).
```python
from bitjoy.dtypes import LogicalOperator
```
- NOT
```python
LogicalOperator.not_(zero)
# OneBit(1)
LogicalOperator.not_(one)
# OneBit(0)
```
- OR
```python
LogicalOperator.or_(zero, zero)
# ZeroBit(0)
LogicalOperator.or_(zero, one)
# OneBit(1)
LogicalOperator.or_(one, zero)
# OneBit(1)
LogicalOperator.or_(one, one)
# OneBit(1)
```
- AND
```python
LogicalOperator.and_(zero, zero)
# ZeroBit(0)
LogicalOperator.and_(zero, one)
# ZeroBit(0)
LogicalOperator.and_(one, zero)
# ZeroBit(0)
LogicalOperator.and_(one, one)
# OneBit(1)
```
There is also support to others Logical Gates:  
`nor_`, `nand_`, xor_` and `xnor_`

### Bytes
There is also a Bytes class.
```python
from bitjoy.dtypes import Bytes
```
Passing a list of Bit to the Bytes' constructor to creating a bytes instance. *NOTE that bytes only have 8 bits. So passing more or less it'll throw an error.*
```python
bits = [Bit(0), Bit(0), Bit(0), Bit(0), Bit(1), Bit(1), Bit(0), Bit(0)]
b = Bytes(bits)
# Bytes(0, 0, 0, 0, 1, 1, 0, 0)
```
To creating a easy bytes, use `int_to_bytes` function from `utils` to help.
```python
from bitjoy.utils import int_to_bytes

b1 = int_to_bytes(10)
# Bytes(0, 0, 0, 0, 1, 0, 1, 0)
b2 = int_to_bytes(175)
# Bytes(1, 0, 1, 0, 1, 1, 1, 1)
```
- Adding Bytes
Bytes class also has support to `+` operand with `__add__` method.
```python
b1_b2 = b1 + b2
# Bytes(1, 0, 1, 1, 1, 0, 0, 1)
```
- Casting
Bytes supports casting with other number types: `int`, `bin`, `oct` and `hex`.
```python
int(b1_b2)
# 185

bin(b1_b2)
# '0b10111001'

oct(b1_b2)
# '0o271'

hex(b1_b2)
# '0xb9'
```

### Adders
For arithmetic operators, the class `Adder` has two method to make additions:  
`half`: to [half-adder](https://www.gatevidyalay.com/half-adder/)  
`full`: to [full-adder](https://www.gatevidyalay.com/full-adder/)