@@ -142,6 +142,8 @@ def main():
142
142
help = "List id of the playlist" , type = str )
143
143
parser .add_argument ('-s' , '--start' , nargs = '?' ,
144
144
help = "Start no. of playlist" , type = int )
145
+ parser .add_argument ('-e' , '--end' , nargs = '?' ,
146
+ help = "End no. of playlist" , type = int )
145
147
args = parser .parse_args ()
146
148
147
149
if args .url :
@@ -152,7 +154,9 @@ def main():
152
154
print (parser .parse_args (['--help' ]))
153
155
154
156
if args .start :
155
- start = args .start
157
+ start = args .start - 1
158
+ if args .end :
159
+ end = args .end
156
160
157
161
try :
158
162
@@ -178,24 +182,26 @@ def main():
178
182
179
183
soup = BeautifulSoup (driver .page_source , 'html.parser' )
180
184
path = soup .find (
181
- "h1" , class_ = "pl-header-title" ).string .replace ('\n ' , '' ).replace (' ' , '' ).replace (',' , '' ).replace ('.' , '' )
185
+ "h1" , class_ = "pl-header-title" ).string .replace ('\n ' , '' ).replace (' ' , '' ).replace (',' , '' ).replace ('.' , '' ). replace ( ':' , '' )
182
186
183
187
_urls = soup .find_all (
184
188
"a" , class_ = "pl-video-title-link" )
185
189
186
190
totalVideos = len (_urls )
191
+ if end == 0 :
192
+ end = totalVideos
187
193
188
194
print ("There are total of " + str (totalVideos ) + " Videos in the playlist" )
189
195
190
196
if not os .path .exists (path ):
191
197
os .system ('mkdir %s' % path )
192
198
193
- for i , ( _url ) in enumerate ( _urls ):
194
- if i + 1 < start :
195
- continue
199
+ for i in range ( start , end ):
200
+
201
+ _url = _urls [ i ]
196
202
197
203
_name = _url .string .replace ('\n ' , '' ).replace (
198
- ' ' , '' ).replace (',' , '' ).replace ('.' , '' )
204
+ ' ' , '' ).replace (',' , '' ).replace ('.' , '' ). replace ( ':' , '' )
199
205
200
206
_name += '.mp4'
201
207
0 commit comments