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

Commit

Permalink
👍 Removed accidential await from sync version
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmercerind committed Jan 29, 2021
1 parent 89abf9d commit 73742ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions youtubesearchpython/handlers/requesthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ def _makeRequest(self) -> None:
def _parseSource(self) -> None:
try:
if not self.continuationKey:
responseContent = await self._getValue(self.response, contentPath)
responseContent = self._getValue(json.loads(self.response), contentPath)
else:
responseContent = await self._getValue(self.response, continuationContentPath)
responseContent = self._getValue(json.loads(self.response), continuationContentPath)
if responseContent:
for element in responseContent:
if itemSectionKey in element.keys():
self.responseSource = await self._getValue(element, [itemSectionKey, 'contents'])
self.responseSource = self._getValue(element, [itemSectionKey, 'contents'])
if continuationItemKey in element.keys():
self.continuationKey = await self._getValue(element, continuationKeyPath)
self.continuationKey = self._getValue(element, continuationKeyPath)
else:
self.responseSource = await self._getValue(self.response, fallbackContentPath)
self.continuationKey = await self._getValue(self.responseSource[-1], continuationKeyPath)
self.responseSource = self._getValue(json.loads(self.response), fallbackContentPath)
self.continuationKey = self._getValue(self.responseSource[-1], continuationKeyPath)
except:
raise Exception('ERROR: Could not parse YouTube response.')
4 changes: 2 additions & 2 deletions youtubesearchpython/internal/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ def _getComponents(self, findVideos: bool, findChannels: bool, findPlaylists: bo
for shelfElement in self._getShelfComponent(element)['elements']:
self.resultComponents.append(self._getVideoComponent(shelfElement, shelfTitle = self.getShelfComponent(element)['title']))
if richItemKey in element.keys():
richItemElement = await self._getValue(element, [richItemKey, 'content'])
richItemElement = self._getValue(element, [richItemKey, 'content'])
''' Initial fallback handling for VideosSearch '''
if videoElementKey in richItemElement.keys():
videoComponent = await self._getVideoComponent(richItemElement)
videoComponent = self._getVideoComponent(richItemElement)
self.resultComponents.append(videoComponent)
if len(self.resultComponents) >= self.limit:
break

0 comments on commit 73742ef

Please sign in to comment.