Skip to content

Commit

Permalink
drop support for python 2 and 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
hbmartin committed Jan 15, 2020
1 parent bceb929 commit fcd83e1
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 106 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ cache:
- apt
- pip
python:
- "2.7"
- "3.4"
- "3.5"
- "3.5-dev" # 3.5 development branch
- "3.6"
- "3.6-dev" # 3.6 development branch
- "3.7-dev" # 3.7 development branch
- "3.7"
install: "make"
script:
- make ci
Expand All @@ -19,4 +15,4 @@ sudo: false
after_success:
coveralls
notifications:
slack: watchcloud:rNoT5kJJakPqwLSKuev6oa4C
# slack: watchcloud:rNoT5kJJakPqwLSKuev6oa4C
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ twine = "*"
more-itertools = "==5.0.0"

[requires]
python_version = "3.6"
python_version = "3.7"
6 changes: 0 additions & 6 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ Mixins
.. automodule:: pytube.mixins
:members:

Compat
------

.. automodule:: pytube.compat
:members:


Helpers
-------
Expand Down
4 changes: 2 additions & 2 deletions pytube/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import json
import logging
from urllib.parse import parse_qsl

from pytube import Caption
from pytube import CaptionQuery
Expand All @@ -19,8 +20,7 @@
from pytube import request
from pytube import Stream
from pytube import StreamQuery
from pytube.compat import install_proxy
from pytube.compat import parse_qsl
from pytube.mixins import install_proxy
from pytube.exceptions import VideoUnavailable
from pytube.helpers import apply_mixin

Expand Down
3 changes: 1 addition & 2 deletions pytube/captions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import xml.etree.ElementTree as ElementTree

from pytube import request
from pytube.compat import unescape

from html import unescape

class Caption:
"""Container for caption tracks."""
Expand Down
72 changes: 0 additions & 72 deletions pytube/compat.py

This file was deleted.

6 changes: 3 additions & 3 deletions pytube/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import json
from collections import OrderedDict

from pytube.compat import HTMLParser
from pytube.compat import quote
from pytube.compat import urlencode
from html.parser import HTMLParser
from urllib.parse import quote
from urllib.parse import urlencode
from pytube.exceptions import RegexMatchError
from pytube.helpers import regex_search

Expand Down
3 changes: 1 addition & 2 deletions pytube/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pprint
import re

from pytube.compat import unicode
from pytube.exceptions import RegexMatchError


Expand Down Expand Up @@ -124,4 +123,4 @@ def safe_filename(s, max_length=255):
pattern = '|'.join(ntfs_chrs + chrs)
regex = re.compile(pattern, re.UNICODE)
filename = regex.sub('', s)
return unicode(filename[:max_length].rsplit(' ', 0)[0])
return filename[:max_length].rsplit(' ', 0)[0]
12 changes: 9 additions & 3 deletions pytube/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import pprint

from pytube import cipher
from pytube.compat import parse_qsl
from pytube.compat import parse_qs
from pytube.compat import unquote
from urllib import request
from urllib.parse import parse_qsl
from urllib.parse import parse_qs
from urllib.parse import unquote
from pytube.exceptions import LiveStreamError


Expand Down Expand Up @@ -117,3 +118,8 @@ def apply_descrambler(stream_data, key):
'applying descrambler\n%s',
pprint.pformat(stream_data[key], indent=2),
)

def install_proxy(proxy_handler):
proxy_support = request.ProxyHandler(proxy_handler)
opener = request.build_opener(proxy_support)
request.install_opener(opener)
7 changes: 3 additions & 4 deletions pytube/request.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
"""Implements a simple wrapper around urlopen."""
import urllib.request

from pytube.compat import urlopen
from urllib.request import Request
from urllib.request import urlopen
# 403 forbidden fix


Expand All @@ -23,7 +22,7 @@ def get(
"""

# https://github.com/nficano/pytube/pull/465
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
req = Request(url, headers={'User-Agent': 'Mozilla/5.0'})
response = urlopen(req)

if streaming:
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ description-file = README.md

[coverage:run]
source = pytube
omit =
pytube/compat.py

[flake8]
ignore = W605
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def run(self):
package_data={
'': ['LICENSE'],
},
url='https://github.com/nficano/pytube',
url='https://github.com/hbmartin/pytube',
license='MIT',
entry_points={
'console_scripts': [
Expand All @@ -71,8 +71,6 @@ def run(self):
'Operating System :: Microsoft',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
Expand Down

0 comments on commit fcd83e1

Please sign in to comment.