wogns3623 / Neotube

Clone of Youtube
0 stars 3 forks source link

watch page API 형식 구성 #15

Closed sunsuking closed 3 years ago

sunsuking commented 3 years ago

watch page 구성: [ video: { "uploader": , "category": , "title": , "tags": , "thumbnail": , "video": , "run_time": , "watch_count": , "description": , "video_like": , "video_dis_like": }, -> video_like등등은 각자 테이블에서 갯수를 추적. uploader: { "user": , "user-image": , "subcribe_count": } -> subcribe_count: subcirbe라는 테이블에서 구독자의 갯수를 추적, comments: [ { "commenter": , "comment_like": , "comment_dis_like": , "comment": }, { "commenter": , "comment_like": , "comment_dis_like": , "comment": }, { "commenter": , "comment_like": , "comment_dis_like": , "comment": } -> comment_like는 테이블에서 갯수를 추적. ], plus_video: [ { "uploader": , "title": , "thumbnail": , "video": , "run_time": , "watch_count": }, { "uploader": , "title": , "thumbnail": , "video": , "run_time": , "watch_count": }, { "uploader": , "title": , "thumbnail": , "video": , "run_time": , "watch_count": } ]
]

sunsuking commented 3 years ago

댓글 작성: https://www.youtube.com/youtubei/v1/comment/create_comment?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8

sunsuking commented 3 years ago

댓글 수정: https://www.youtube.com/youtubei/v1/comment/update_comment?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8

sunsuking commented 3 years ago

댓글 삭제: https://www.youtube.com/youtubei/v1/comment/perform_comment_action?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8

sunsuking commented 3 years ago

새로운 댓글 작성: https://www.youtube.com/youtubei/v1/comment/create_comment?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8

sunsuking commented 3 years ago

새로운 댓글 삭제: https://www.youtube.com/youtubei/v1/comment/perform_comment_action?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8

YouKnowGit commented 3 years ago
from django.shortcuts import render
from .models import Video, VideoLike, Category, CommentLike, CommentDisLike, VideoDisLike, Comment, Tag

def primary_inner(request):
    if request.method == 'GET':
        video = Video.objects.get(pk=request.get.id)
        category = Category.objects.get(pk=video.pk)
        tag = Tag.objects.get(pk=video.pk)
        comment = Comment.objects.get(pk=video.pk)
        comment_like = CommentLike.objects.filter(comment=comment.pk)
        comment_dis_like = CommentDisLike.objects.filter(comment=comment.pk)

        return render(request, 'template/primary_inner.html', {
            'video': video,
            'category': category,
            'tag': tag,
            'comment': comment
            'clike': comment_like,
            'cdislike': comment_dis_like
        })

def secondary(request):
    if request.method == 'GET':
        related = Video.objects.all()
        video_like = VideoLike.objects.filter(video=related.pk)
        video_dis_like = VideoDisLike.objects.filter(video=related.pk)

        return render(request, 'template/related.html', {
            'related': related,
            'vlike': video_like,
            'vdislike': video_dis_like
        })
sunsuking commented 3 years ago

127.0.0.1:8000/watch/1 -> 비디오랑 유저 정보 127.0.0.1:8000/watch/1/next -> 추가 영상 127.0.0.1:8000/watch/1/comments -> 댓글

Mertkose39 commented 3 years ago

How can I subscribe in channel