|
|
@ -3,6 +3,7 @@
|
|
|
|
from api.src.search_processor import SearchProcess
|
|
|
|
from api.src.search_processor import SearchProcess
|
|
|
|
from home.src.download.thumbnails import ThumbManager
|
|
|
|
from home.src.download.thumbnails import ThumbManager
|
|
|
|
from home.src.es.connect import ElasticWrap
|
|
|
|
from home.src.es.connect import ElasticWrap
|
|
|
|
|
|
|
|
from home.src.index.video import SponsorBlock
|
|
|
|
from home.src.ta.config import AppConfig
|
|
|
|
from home.src.ta.config import AppConfig
|
|
|
|
from home.src.ta.helper import UrlListParser
|
|
|
|
from home.src.ta.helper import UrlListParser
|
|
|
|
from home.src.ta.ta_redis import RedisArchivist
|
|
|
|
from home.src.ta.ta_redis import RedisArchivist
|
|
|
@ -144,6 +145,35 @@ class VideoProgressView(ApiBaseView):
|
|
|
|
return Response(self.response)
|
|
|
|
return Response(self.response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VideoSponsorView(ApiBaseView):
|
|
|
|
|
|
|
|
"""resolves to /api/video/<video_id>/
|
|
|
|
|
|
|
|
handle sponsor block integration
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
search_base = "ta_video/_doc/"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get(self, request, video_id):
|
|
|
|
|
|
|
|
"""get sponsor info"""
|
|
|
|
|
|
|
|
# pylint: disable=unused-argument
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.get_document(video_id)
|
|
|
|
|
|
|
|
sponsorblock = self.response["data"].get("sponsorblock")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Response(sponsorblock)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def post(request, video_id):
|
|
|
|
|
|
|
|
"""post verification and timestamps"""
|
|
|
|
|
|
|
|
start_time = request.data.get("startTime")
|
|
|
|
|
|
|
|
end_time = request.data.get("endTime")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
response, status_code = SponsorBlock(request.user.id).post_timestamps(
|
|
|
|
|
|
|
|
video_id, start_time, end_time
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Response(response, status=status_code)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ChannelApiView(ApiBaseView):
|
|
|
|
class ChannelApiView(ApiBaseView):
|
|
|
|
"""resolves to /api/channel/<channel_id>/
|
|
|
|
"""resolves to /api/channel/<channel_id>/
|
|
|
|
GET: returns metadata dict of channel
|
|
|
|
GET: returns metadata dict of channel
|
|
|
|