Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion crawlingserver/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

app = FastAPI()

Expand All @@ -20,10 +22,19 @@ class Song(BaseModel):
class SongRequest(BaseModel):
songs: List[Song]

options = wb.ChromeOptions()
options.add_argument('headless')
options.add_argument('window-size=1920x1080')
options.add_argument("disable-gpu")
options.add_argument(f'user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36')

service = Service(executable_path=ChromeDriverManager().install())


#json request 요청양식은 이쪽에서 정의
@app.post("/getYoutubeUrls")
async def get_youtube_urls(request: SongRequest):
driver = wb.Chrome()
driver = wb.Chrome(service=service, options=options)
results = []
for song in request.songs:
song_id = song.songId
Expand Down
1 change: 1 addition & 0 deletions turntable/src/main/webapp/WEB-INF/views/todayPlaylist.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@
success: function(response) {
console.log("Playlist saved successfully:", response);
alert("플레이리스트가 성공적으로 저장되었습니다!");
window.location.href = "/main";
},
error: function(xhr, status, error) {
console.error(`Error: ${'${status}'}, ${error}`);
Expand Down