ko28/melon-api

scrapeMelon.py songId regex error

Closed this issue · 1 comments

scrapeMelon.py코드에서
songId를 정규식으로 가져오는데 버그가 있습니다.

re.search(r'goSongDetail\(\'(.*)\'\)', str(tag)).group(1),

로 가져오게되면 제목에 특수문자(', \ 등) 이들어갈때 제대로 문자만 가져올 수 없는 에러가 있습니다.
일례로
href="javascript:melon.link.goSongDetail('30287019');" title="롤린 (Rollin')으로부터 파싱해올떄
Rollin' 때문에 숫자뿐만 아니라 30287019');" title="롤린 (Rollin 까지 모두 가져와지는 버그가 있습니다.
숫자만을 명확하게 가져오기 위해

re.search(r'goSongDetail\(\'([0-9]+)\'\)', str(tag)).group(1),

등으로 수정해주세요
감사합니다.

ko28 commented

버그 찾아주셔서 감사합니다!! 다음 release에 버그를 수정할 테니 그때까지 양해부탁드립니다!

Thanks for finding this bug! I have never actually used the ID's for songs before. I'll definitely fix this before the next release :)