File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ import scrapetube
2+ import sys
3+
4+ path = '_list.txt'
5+
6+ print ('**********************\n ' )
7+ print ("The result will be saved in '_list.txt' file." )
8+ print ("Enter Channel ID:" )
9+
10+ # Prints the output in the console and into the '_list.txt' file.
11+ class Logger :
12+
13+ def __init__ (self , filename ):
14+ self .console = sys .stdout
15+ self .file = open (filename , 'w' )
16+
17+ def write (self , message ):
18+ self .console .write (message )
19+ self .file .write (message )
20+
21+ def flush (self ):
22+ self .console .flush ()
23+ self .file .flush ()
24+
25+ sys .stdout = Logger (path )
26+
27+ # Strip the: "https://www.youtube.com/channel/"
28+ channel_id_input = input ()
29+ channel_id = channel_id_input .strip ("https://www.youtube.com/channel/" )
30+
31+ videos = scrapetube .get_channel (channel_id )
32+
33+ for video in videos :
34+ print ("https://www.youtube.com/watch?v=" + str (video ['videoId' ]))
35+ # print(video['videoId'])
You can’t perform that action at this time.
0 commit comments