Fix errors introduced with previous code cleanup

This commit is contained in:
Linus
2017-06-28 16:21:24 +02:00
parent 0f384bb5ee
commit e20be5d97e
2 changed files with 3 additions and 3 deletions

View File

@@ -75,7 +75,7 @@ def generate_youtube_url(raw_song):
# fetch all video links on first page on YouTube
for x in items_parse.find_all('h3', {'class': 'yt-lockup-title'}):
# confirm the video result is not an advertisement
if not x.find('channel') == -1 or not x.find('googleads') == -1:
if x.find('channel') > -1 or x.find('googleads') > -1:
print('{0}. {1}'.format(check, x.get_text()))
links.append(x.find('a')['href'])
check += 1
@@ -91,7 +91,7 @@ def generate_youtube_url(raw_song):
# confirm the video result is not an advertisement
# otherwise keep iterating until it is not
while result.find('channel') < 0 or result.find('googleads') < 0:
while result.find('channel') > -1 or result.find('googleads') > -1:
result = items_parse.find_all(
attrs={'class': 'yt-uix-tile-link'})[check]['href']
check += 1