#I can get transcripts from some channels really smoothly, but sometimes I get this error message:
Traceback (most recent call last):
File "C:\Users\coope\PycharmProjects\HelloWorld\app.py", line 7, in
videos_errored = channel_getter.write_transcripts('C:/Users/coope/Desktop/HHClubNite_Transcripts/') # don't forget to have that last /
File "C:\Users\coope\PycharmProjects\HelloWorld\venv\lib\site-packages\youtube_channel_transcript_api\transcripts.py", line 52, in write_transcripts
with open(filepath, 'w') as f:
OSError: [Errno 22] Invalid argument: 'C:/Users/coope/Desktop/HHClubNite_Transcripts/Spencer_Jones_asks_โDo_You_Remember_My_Mum?โ.json'
#Other examples:
OSError: [Errno 22] Invalid argument: 'C:/Users/coope/Desktop/PeepShow_Transcripts/Mark_and_Jez_Play_Doubles_Tennis_|_Peep_Show.json'
OSError: [Errno 22] Invalid argument: "C:/Users/coope/Desktop/Comedyon4_Transcripts/BAD_DAY??_๐ค_This_will_make_you_laugh_so_hard_you'll_cry_๐คฃ๐ฅ_Ep._20.json"
#Is the problem possibly that the video titles include irregular characters like emojis, '|' and '?'
#I am new to python, so I could be making a basic error, this is the code I used (the same code works perfectly with some channels):
from youtube_channel_transcript_api import YoutubeChannelTranscripts
channel_getter = YoutubeChannelTranscripts('UCEZVbBq-gdk0_P369jZv0Vw', 'My_API_Key')
videos_errored = channel_getter.write_transcripts('C:/Users/coope/Desktop/HHClubNite_Transcripts/', just_text=True)