linting
Browse files- .gitignore +1 -1
- pytube/contrib/playlist.py +8 -4
- pytube/query.py +2 -2
- setup.cfg +2 -3
- setup.py +2 -1
.gitignore
CHANGED
@@ -42,4 +42,4 @@ _autosummary
|
|
42 |
.pytest_cache*
|
43 |
|
44 |
#Pycharm stuff
|
45 |
-
.idea/*
|
|
|
42 |
.pytest_cache*
|
43 |
|
44 |
#Pycharm stuff
|
45 |
+
.idea/*
|
pytube/contrib/playlist.py
CHANGED
@@ -47,7 +47,8 @@ class Playlist(object):
|
|
47 |
try:
|
48 |
load_more_url = 'https://www.youtube.com' + re.search(
|
49 |
r'data-uix-load-more-href=\"(/browse_ajax\?'
|
50 |
-
'action_continuation=.*?)\"', req
|
|
|
51 |
except AttributeError:
|
52 |
load_more_url = ''
|
53 |
return load_more_url
|
@@ -74,12 +75,15 @@ class Playlist(object):
|
|
74 |
logger.debug('load more url: %s' % load_more_url)
|
75 |
req = request.get(load_more_url)
|
76 |
load_more = json.loads(req)
|
77 |
-
videos = re.findall(
|
78 |
-
|
|
|
|
|
79 |
# remove duplicates
|
80 |
link_list.extend(list(OrderedDict.fromkeys(videos)))
|
81 |
load_more_url = self._load_more_url(
|
82 |
-
|
|
|
83 |
|
84 |
return link_list
|
85 |
|
|
|
47 |
try:
|
48 |
load_more_url = 'https://www.youtube.com' + re.search(
|
49 |
r'data-uix-load-more-href=\"(/browse_ajax\?'
|
50 |
+
'action_continuation=.*?)\"', req,
|
51 |
+
).group(1)
|
52 |
except AttributeError:
|
53 |
load_more_url = ''
|
54 |
return load_more_url
|
|
|
75 |
logger.debug('load more url: %s' % load_more_url)
|
76 |
req = request.get(load_more_url)
|
77 |
load_more = json.loads(req)
|
78 |
+
videos = re.findall(
|
79 |
+
r'href=\"(/watch\?v=[\w-]*)',
|
80 |
+
load_more['content_html'],
|
81 |
+
)
|
82 |
# remove duplicates
|
83 |
link_list.extend(list(OrderedDict.fromkeys(videos)))
|
84 |
load_more_url = self._load_more_url(
|
85 |
+
load_more['load_more_widget_html'],
|
86 |
+
)
|
87 |
|
88 |
return link_list
|
89 |
|
pytube/query.py
CHANGED
@@ -130,14 +130,14 @@ class StreamQuery:
|
|
130 |
if only_audio:
|
131 |
filters.append(
|
132 |
lambda s: (
|
133 |
-
|
134 |
),
|
135 |
)
|
136 |
|
137 |
if only_video:
|
138 |
filters.append(
|
139 |
lambda s: (
|
140 |
-
|
141 |
),
|
142 |
)
|
143 |
|
|
|
130 |
if only_audio:
|
131 |
filters.append(
|
132 |
lambda s: (
|
133 |
+
s.includes_audio_track and not s.includes_video_track
|
134 |
),
|
135 |
)
|
136 |
|
137 |
if only_video:
|
138 |
filters.append(
|
139 |
lambda s: (
|
140 |
+
s.includes_video_track and not s.includes_audio_track
|
141 |
),
|
142 |
)
|
143 |
|
setup.cfg
CHANGED
@@ -3,7 +3,7 @@ commit = True
|
|
3 |
tag = True
|
4 |
current_version = 9.3.4
|
5 |
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?
|
6 |
-
serialize =
|
7 |
{major}.{minor}.{patch}
|
8 |
|
9 |
[metadata]
|
@@ -15,6 +15,5 @@ description-file = README.md
|
|
15 |
|
16 |
[coverage:run]
|
17 |
source = pytube
|
18 |
-
omit =
|
19 |
pytube/compat.py
|
20 |
-
|
|
|
3 |
tag = True
|
4 |
current_version = 9.3.4
|
5 |
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?
|
6 |
+
serialize =
|
7 |
{major}.{minor}.{patch}
|
8 |
|
9 |
[metadata]
|
|
|
15 |
|
16 |
[coverage:run]
|
17 |
source = pytube
|
18 |
+
omit =
|
19 |
pytube/compat.py
|
|
setup.py
CHANGED
@@ -44,6 +44,7 @@ class UploadCommand(Command):
|
|
44 |
os.system('twine upload dist/*')
|
45 |
sys.exit()
|
46 |
|
|
|
47 |
setup(
|
48 |
name='pytube',
|
49 |
version='9.3.4',
|
@@ -52,7 +53,7 @@ setup(
|
|
52 |
packages=['pytube', 'pytube.contrib'],
|
53 |
package_data={
|
54 |
'': ['LICENSE'],
|
55 |
-
},
|
56 |
url='https://github.com/nficano/pytube',
|
57 |
license='MIT',
|
58 |
entry_points={
|
|
|
44 |
os.system('twine upload dist/*')
|
45 |
sys.exit()
|
46 |
|
47 |
+
|
48 |
setup(
|
49 |
name='pytube',
|
50 |
version='9.3.4',
|
|
|
53 |
packages=['pytube', 'pytube.contrib'],
|
54 |
package_data={
|
55 |
'': ['LICENSE'],
|
56 |
+
},
|
57 |
url='https://github.com/nficano/pytube',
|
58 |
license='MIT',
|
59 |
entry_points={
|