TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
"""Shazam Playlist to Youtube Playlist"""
|
2 |
|
|
|
3 |
import pandas as pd
|
4 |
from pytube import Search, YouTube
|
5 |
from flask import Flask, request, send_from_directory
|
@@ -34,8 +35,8 @@ def parse_csv():
|
|
34 |
return shazamlibrary_df.to_html(index=False, justify="left")
|
35 |
except Exception as e:
|
36 |
return str(e)
|
37 |
-
|
38 |
-
|
39 |
-
def _get_youtube_song(title: str, artist: str) -> YouTube
|
40 |
search_result = Search(f'{title} by {artist}')
|
41 |
return search_result.results[0] if search_result.results else None
|
|
|
1 |
"""Shazam Playlist to Youtube Playlist"""
|
2 |
|
3 |
+
from typing import Optional
|
4 |
import pandas as pd
|
5 |
from pytube import Search, YouTube
|
6 |
from flask import Flask, request, send_from_directory
|
|
|
35 |
return shazamlibrary_df.to_html(index=False, justify="left")
|
36 |
except Exception as e:
|
37 |
return str(e)
|
38 |
+
|
39 |
+
|
40 |
+
def _get_youtube_song(title: str, artist: str) -> Optional[YouTube]:
|
41 |
search_result = Search(f'{title} by {artist}')
|
42 |
return search_result.results[0] if search_result.results else None
|