Skip to content

Commit 8477c18

Browse files
authored
Update youtuber.py
1 parent ad63f8f commit 8477c18

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

youtuber.py

+23-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,26 @@
1818
for i, item in enumerate(video):
1919
video = result['entries'][i]
2020
# fetch the url and title of video
21-
print('|'+ result['entries'][i]['title'] +'|[Watch]('+result['entries'][i]['webpage_url']+')|'+'-|')
21+
print('|'+ result['entries'][i]['title'] +'|[Watch Here]('+result['entries'][i]['webpage_url']+')|'+'-|')
22+
23+
#Alternate method
24+
import youtube_dl
25+
import os
26+
27+
start = 101;
28+
end = 154;
29+
30+
# For fetching the title of the video in playlist
31+
cmd_code1='py -m youtube_dl -e --playlist-start ' +str(start)+' --playlist-end '+str(end)+' https://www.youtube.com/playlist?list=PLj6h78yzYM2PpmMAnvpvsnR4c27wJePh3'
32+
title = os.popen(cmd_code1).read().splitlines()
33+
#print(title[0])
34+
35+
# For fetching the id of that particular video in playlist
36+
cmd_code2='py -m youtube_dl --get-id --playlist-start ' +str(start)+' --playlist-end '+str(end)+' https://www.youtube.com/playlist?list=PLj6h78yzYM2PpmMAnvpvsnR4c27wJePh3'
37+
video_id = os.popen(cmd_code2).read().splitlines()
38+
39+
print('| Topic | Video | Presentation |')
40+
print('| ------------- |:-------------:| -----:|')
41+
42+
for i in range(0, len(title)):
43+
print('|'+ title[i] +'|[Watch Here](https://www.youtube.com/watch?v='+video_id[i]+')|'+'-|')

0 commit comments

Comments
 (0)