Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
👌 Fixed video titles containing quotes (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmercerind committed Sep 17, 2020
1 parent 2d6284b commit 3c611c4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions youtubesearchpython/videos__scripthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,17 @@ def scriptResponseHandler(self):

if self.pageSource[index][-23:] == '"title":{"runs":[{"text' and self.pageSource[index+1][-44:] == '"accessibility":{"accessibilityData":{"label':
titleBuffer = ""
for character in self.pageSource[index+1]:
if character!= '"':
titleBuffer+=character
for subIndex in range(len(self.pageSource[index+1])):
if self.pageSource[index+1][subIndex: subIndex+2] != '}]':
''' For getting rid of " written as \" '''
if self.pageSource[index+1][subIndex] == '"' and self.pageSource[index+1][subIndex+1: subIndex+3] != '}]':
titleBuffer = titleBuffer[:-1]
titleBuffer+=self.pageSource[index+1][subIndex]
else:
titleBuffer = titleBuffer[:-1]
break
self.titles+=[titleBuffer.replace("\\u0026", "&")]

self.views+=["LIVE"]
self.durations+=["LIVE"]
self.channels+= [""]
Expand Down

0 comments on commit 3c611c4

Please sign in to comment.