anyaudio / anyaudio-server

:musical_note: Simple server to search youtube and give direct audio download and stream links
91 stars 19 forks source link

Create API for 'Up Next' for streaming #116

Closed bxute closed 7 years ago

bxute commented 7 years ago

In Order to have break-free streaming , 'Up Next ||>' is required.

a given try is as:

from urllib import request
import re
root = 'https://www.youtube.com/watch'
home_url= root + '?v=OL9bGGOd8yo'
reg_for_title = r'title="(.*?)"'
reg_for_url = r'<a href="/watch(.*?)"'
reg_for_block = r'<div class="watch-sidebar-body">(.*?)</span>\\n</a>'
source = str(request.urlopen(str(home_url)).read())
_block = re.findall(reg_for_block,source)
_up_next_song_url = re.findall(reg_for_url, _block[0])
_up_next_song_title = re.findall(reg_for_title,_block[0])
print(_up_next_song_url)
print(_up_next_song_title)
singhpratyush commented 7 years ago

There is a .../suggest endpoint where you can get suggestions for related videos. This issue happens to be a special case where you just need the first result. Since getting suggested videos is already implemented in the backend, I feel like frontend should implement the task to take first video from suggestions and play it.

singhpratyush commented 7 years ago

If there's nothing that needs to be fixed, shall we close the issue?