from apiclient.discovery import build
import os

from .info import Info


class VidQuerier(Info):
    def __init__(
        self, keyword, maxlen, order="relevance", type="video", videoCategoryId=27
    ):
        self.keyword = keyword
        self.maxlen = maxlen
        self.order = order
        self.type = type
        super().__init__(order="relevance", type="video")
        req = self.youtube.search().list(
            q=self.keyword,
            part="snippet",
            maxResults=self.maxlen,
            type=self.type,
            order=self.order,
            videoCategoryId=videoCategoryId,
        )
        self.result = req.execute()

    def get_result(self):
        return self.result


class VidCmntQuerier:
    def __init__(self, id):
        try:
            self.__API_KEY = os.environ.get(
                "API_KEY"
            )  # link to get the api key is in readme file
        except Exception:
            raise TypeError("You must have API_KEY set as an environment variable")
        youtube = build("youtube", "v3", developerKey=self.__API_KEY)
        self.youtube = youtube
        self.__id = id

        request = youtube.commentThreads().list(part="snippet", videoId=self.__id)
        self.result = request.execute()

    def get_result(self):
        return self.result

7f0d730982f2ef896b2cc0e8dcca8f630fee943f
<mask token>


class VidCmntQuerier:

    def __init__(self, id):
        try:
            self.__API_KEY = os.environ.get('API_KEY')
        except Exception:
            raise TypeError(
                'You must have API_KEY set as an environment variable')
        youtube = build('youtube', 'v3', developerKey=self.__API_KEY)
        self.youtube = youtube
        self.__id = id
        request = youtube.commentThreads().list(part='snippet', videoId=
            self.__id)
        self.result = request.execute()

    def get_result(self):
        return self.result

<mask token>


class VidQuerier(Info):
    <mask token>
    <mask token>


class VidCmntQuerier:

    def __init__(self, id):
        try:
            self.__API_KEY = os.environ.get('API_KEY')
        except Exception:
            raise TypeError(
                'You must have API_KEY set as an environment variable')
        youtube = build('youtube', 'v3', developerKey=self.__API_KEY)
        self.youtube = youtube
        self.__id = id
        request = youtube.commentThreads().list(part='snippet', videoId=
            self.__id)
        self.result = request.execute()

    def get_result(self):
        return self.result

<mask token>


class VidQuerier(Info):
    <mask token>

    def get_result(self):
        return self.result


class VidCmntQuerier:

    def __init__(self, id):
        try:
            self.__API_KEY = os.environ.get('API_KEY')
        except Exception:
            raise TypeError(
                'You must have API_KEY set as an environment variable')
        youtube = build('youtube', 'v3', developerKey=self.__API_KEY)
        self.youtube = youtube
        self.__id = id
        request = youtube.commentThreads().list(part='snippet', videoId=
            self.__id)
        self.result = request.execute()

    def get_result(self):
        return self.result

<mask token>


class VidQuerier(Info):

    def __init__(self, keyword, maxlen, order='relevance', type='video',
        videoCategoryId=27):
        self.keyword = keyword
        self.maxlen = maxlen
        self.order = order
        self.type = type
        super().__init__(order='relevance', type='video')
        req = self.youtube.search().list(q=self.keyword, part='snippet',
            maxResults=self.maxlen, type=self.type, order=self.order,
            videoCategoryId=videoCategoryId)
        self.result = req.execute()

    def get_result(self):
        return self.result


class VidCmntQuerier:

    def __init__(self, id):
        try:
            self.__API_KEY = os.environ.get('API_KEY')
        except Exception:
            raise TypeError(
                'You must have API_KEY set as an environment variable')
        youtube = build('youtube', 'v3', developerKey=self.__API_KEY)
        self.youtube = youtube
        self.__id = id
        request = youtube.commentThreads().list(part='snippet', videoId=
            self.__id)
        self.result = request.execute()

    def get_result(self):
        return self.result

from apiclient.discovery import build
import os

from .info import Info


class VidQuerier(Info):
    def __init__(
        self, keyword, maxlen, order="relevance", type="video", videoCategoryId=27
    ):
        self.keyword = keyword
        self.maxlen = maxlen
        self.order = order
        self.type = type
        super().__init__(order="relevance", type="video")
        req = self.youtube.search().list(
            q=self.keyword,
            part="snippet",
            maxResults=self.maxlen,
            type=self.type,
            order=self.order,
            videoCategoryId=videoCategoryId,
        )
        self.result = req.execute()

    def get_result(self):
        return self.result


class VidCmntQuerier:
    def __init__(self, id):
        try:
            self.__API_KEY = os.environ.get(
                "API_KEY"
            )  # link to get the api key is in readme file
        except Exception:
            raise TypeError("You must have API_KEY set as an environment variable")
        youtube = build("youtube", "v3", developerKey=self.__API_KEY)
        self.youtube = youtube
        self.__id = id

        request = youtube.commentThreads().list(part="snippet", videoId=self.__id)
        self.result = request.execute()

    def get_result(self):
        return self.result
