def __ignore_cookie_law(self):
        """ Accepts the cookies from RTL channel in order to have the site available """

        Logger.info("Setting the Cookie-Consent cookie for www.uitzendinggemist.nl")

        # the rfc2109 parameters is not valid in Python 2.4 (Xbox), so we ommit it.
        UriHandler.set_cookie(name='rtlcookieconsent', value='yes', domain='.www.rtl.nl')
        return
    def __ignore_cookie_law(self):
        """ Accepts the cookies from UZG in order to have the site available """

        Logger.info(
            "Setting the Cookie-Consent cookie for www.uitzendinggemist.nl")

        # a second cookie seems to be required
        UriHandler.set_cookie(name='npo_cc', value='tmp', domain='.nos.nl')
        return
    def __ignore_cookie_law(self):
        """ Accepts the cookies from UZG in order to have the site available """

        Logger.info("Setting the Cookie-Consent cookie for www.dumpert.nl")

        # Set-Cookie: cpc=10; path=/; domain=www.dumpert.nl; expires=Thu, 11-Jun-2020 18:49:38 GMT
        UriHandler.set_cookie(name='cpc', value='10', domain='.www.dumpert.nl')
        UriHandler.set_cookie(name='cpc',
                              value='10',
                              domain='.legacy.dumpert.nl')
        return
    def __init__(self, channel_info):
        """ Initialisation of the class.

        All class variables should be instantiated here and this method should not
        be overridden by any derived classes.

        :param ChannelInfo channel_info: The channel info object to base this channel on.

        """

        chn_class.Channel.__init__(self, channel_info)

        # ============== Actual channel setup STARTS here and should be overwritten from derived classes ===============
        # setup the urls
        self.baseUrl = "https://www.kijk.nl"

        if self.channelCode is None:
            self.noImage = "kijkimage.png"
            self.mainListUri = self.__get_api_query_url(
                "programs(programTypes:[SERIES],limit:1000)",
                "{items{__typename,title,description,guid,updated,seriesTvSeasons{id},"
                "imageMedia{url,label}}}")

            self._add_data_parser("#recentgraphql",
                                  preprocessor=self.add_graphql_recents,
                                  name="GraphQL Recent listing")

            self._add_data_parser(
                "https://graph.kijk.nl/graphql?query=query%7Bprograms%28programTypes",
                name="Main GraphQL Program parser",
                json=True,
                preprocessor=self.add_graphql_extras,
                parser=["data", "programs", "items"],
                creator=self.create_api_typed_item)

            self._add_data_parser(
                "https://graph.kijk.nl/graphql?query=query%7Bprograms%28guid",
                name="Main GraphQL season overview parser",
                json=True,
                parser=["data", "programs", "items", 0, "seriesTvSeasons"],
                creator=self.create_api_tvseason_type)

            self._add_data_parser(
                "https://graph.kijk.nl/graphql?query=query%7BprogramsByDate",
                name="Main GraphQL programs per date parser",
                json=True,
                parser=["data", "programsByDate", 0, "items"],
                creator=self.create_api_typed_item)

            self._add_data_parser(
                "https://graph.kijk.nl/graphql?query=query%7BtrendingPrograms",
                name="GraphQL trending parser",
                json=True,
                parser=["data", "trendingPrograms"],
                creator=self.create_api_typed_item)

            self._add_data_parsers([
                "https://graph.kijk.nl/graphql?operationName=programs",
                "https://graph.kijk.nl/graphql?query=query%7Bprograms%28tvSeasonId"
            ],
                                   name="GraphQL season video listing parsing",
                                   json=True,
                                   parser=["data", "programs", "items"],
                                   creator=self.create_api_typed_item)

            self._add_data_parser(
                "https://graph.kijk.nl/graphql?query=query%7Bsearch",
                name="GraphQL search",
                json=True,
                parser=["data", "search", "items"],
                creator=self.create_api_typed_item)

            self._add_data_parser("https://graph.kijk.nl/graphql-video",
                                  updater=self.update_graphql_item)

        else:
            raise ValueError("Channel with code '{}' not supported".format(
                self.channelCode))

        # setup the main parsing data
        self._add_data_parser("#lastweek",
                              name="Last week listing",
                              json=True,
                              preprocessor=self.list_dates)

        self._add_data_parser("https://embed.kijk.nl/",
                              updater=self.update_json_video_item)

        #===============================================================================================================
        # non standard items
        self.__video_fields = \
            "{items{__typename,title,description,guid,updated,seriesTvSeasons{id}," \
            "imageMedia{url,label},type,sources{type,drm,file},series{title}," \
            "seasonNumber,tvSeasonEpisodeNumber,lastPubDate,duration,displayGenre,tracks{type,file}}}"

        #===============================================================================================================
        # Test cases:

        # ====================================== Actual channel setup STOPS here =======================================
        UriHandler.set_cookie(name="OPTOUTMULTI",
                              value="0:0%7Cc5:0%7Cc1:0%7Cc4:0%7Cc3:0%7Cc2:0",
                              domain=".kijk.nl")
        return
Beispiel #5
0
    def __init__(self, channel_info):
        """ Initialisation of the class.

        All class variables should be instantiated here and this method should not
        be overridden by any derived classes.

        :param ChannelInfo channel_info: The channel info object to base this channel on.

        """

        chn_class.Channel.__init__(self, channel_info)

        # ============== Actual channel setup STARTS here and should be overwritten from derived classes ===============
        # setup the urls
        self.baseUrl = "https://www.kijk.nl"
        # Just retrieve a single page with 500 items (should be all)

        use_html = False
        if use_html:
            self.mainListUri = "https://www.kijk.nl/programmas"
        else:
            self.mainListUri = "https://api.kijk.nl/v1/default/sections/programs-abc-0123456789abcdefghijklmnopqrstuvwxyz?limit=350&offset=0"

        self.__channelId = self.channelCode
        if self.channelCode == 'veronica':
            self.noImage = "veronicaimage.png"
            self.__channelId = "veronicatv"

        elif self.channelCode == 'sbs':
            self.noImage = "sbs6image.jpg"
            self.__channelId = "sbs6"

        elif self.channelCode == 'sbs9':
            self.noImage = "sbs9image.png"

        elif self.channelCode == 'net5':
            self.noImage = "net5image.png"

        else:
            self.noImage = "kijkimage.png"

        # setup the main parsing data
        self._add_data_parser(
            "https://api.kijk.nl/v1/default/sections/programs-abc",
            name="Mainlist Json",
            json=True,
            preprocessor=self.add_others,
            parser=[
                "items",
            ],
            creator=self.create_json_episode_item)

        self._add_data_parser("https://www.kijk.nl/programmas",
                              match_type=ParserData.MatchExact,
                              name="Mainlist from HTML",
                              json=True,
                              preprocessor=self.extract_main_list_json)

        self._add_data_parser(
            "https://api.kijk.nl/v2/templates/page/format/",
            name="Videos from the main show format page",
            json=True,
            parser=["components", 3, "data", "items", 2, "data", "items"],
            creator=self.create_json_season_item)

        self._add_data_parser("#lastweek",
                              name="Last week listing",
                              json=True,
                              preprocessor=self.list_dates)

        self._add_data_parsers([
            "https://api.kijk.nl/v2/templates/page/missed/all/",
            "https://api.kijk.nl/v1/default/sections/missed-all-"
        ],
                               name="Day listing",
                               json=True,
                               preprocessor=self.extract_day_items)

        self._add_data_parser(
            "https://api.kijk.nl/v1/default/searchresultsgrouped",
            name="VideoItems Json",
            json=True,
            parser=[],
            creator=self.create_json_search_item)

        self._add_data_parsers([
            "https://api.kijk.nl/v1/default/sections/series",
            "https://api.kijk.nl/v1/default/seasons/"
        ],
                               name="VideoItems Json",
                               json=True,
                               parser=[
                                   "items",
                               ],
                               creator=self.create_json_video_item)

        self._add_data_parser(
            "https://api.kijk.nl/v2/default/sections/popular",
            name="Popular items Json",
            json=True,
            parser=[
                "items",
            ],
            creator=self.create_json_popular_item)

        self._add_data_parser("https://embed.kijk.nl/",
                              updater=self.update_json_video_item)

        #===============================================================================================================
        # non standard items

        #===============================================================================================================
        # Test cases:
        #  Piets Weer: no clips
        #  Achter gesloten deuren: seizoenen
        #  Wegmisbruikers: episodes and clips and both pages
        #  Utopia: no clips
        #  Grand Designs has almost all encrypted/non-encrypted/brigthcove streams

        # ====================================== Actual channel setup STOPS here =======================================
        UriHandler.set_cookie(name="OPTOUTMULTI",
                              value="0:0%7Cc5:0%7Cc1:0%7Cc4:0%7Cc3:0%7Cc2:0",
                              domain=".kijk.nl")
        return
    def __init__(self, channel_info):
        """ Initialisation of the class.

        All class variables should be instantiated here and this method should not
        be overridden by any derived classes.

        :param ChannelInfo channel_info: The channel info object to base this channel on.

        """

        chn_class.Channel.__init__(self, channel_info)

        # ============== Actual channel setup STARTS here and should be overwritten from derived classes ===============
        # setup the urls
        self.baseUrl = "https://www.kijk.nl"
        # Just retrieve a single page with 500 items (should be all)

        use_html = False
        if use_html:
            self.mainListUri = "https://www.kijk.nl/programmas"
        else:
            self.mainListUri = "https://api.kijk.nl/v1/default/sections/programs-abc-0123456789abcdefghijklmnopqrstuvwxyz?limit=350&offset=0"

        self.__channelId = self.channelCode
        if self.channelCode == 'veronica':
            self.noImage = "veronicaimage.png"
            self.__channelId = "veronicatv"

        elif self.channelCode == 'sbs':
            self.noImage = "sbs6image.jpg"
            self.__channelId = "sbs6"

        elif self.channelCode == 'sbs9':
            self.noImage = "sbs9image.png"

        elif self.channelCode == 'net5':
            self.noImage = "net5image.png"

        else:
            self.noImage = "kijkimage.png"
            self.mainListUri = self.__get_api_query_url(
                "programs(programTypes:[SERIES],limit:1000)",
                "{items{__typename,title,description,guid,updated,seriesTvSeasons{id},"
                "imageMedia{url,label}}}")

            self._add_data_parser("#recentgraphql", preprocessor=self.add_graphql_recents,
                                  name="GraphQL Recent listing")

            self._add_data_parser("https://graph.kijk.nl/graphql?query=query%7Bprograms%28programTypes",
                                  name="Main GraphQL Program parser", json=True,
                                  preprocessor=self.add_graphql_extras,
                                  parser=["data", "programs", "items"], creator=self.create_api_typed_item)

            self._add_data_parser("https://graph.kijk.nl/graphql?query=query%7Bprograms%28guid",
                                  name="Main GraphQL season overview parser", json=True,
                                  parser=["data", "programs", "items", 0, "seriesTvSeasons"],
                                  creator=self.create_api_tvseason_type)

            self._add_data_parser("https://graph.kijk.nl/graphql?query=query%7BprogramsByDate",
                                  name="Main GraphQL programs per date parser", json=True,
                                  parser=["data", "programsByDate", 0, "items"],
                                  creator=self.create_api_typed_item)

            self._add_data_parser("https://graph.kijk.nl/graphql?query=query%7BtrendingPrograms",
                                  name="GraphQL trending parser", json=True,
                                  parser=["data", "trendingPrograms"],
                                  creator=self.create_api_typed_item)

            self._add_data_parsers(["https://graph.kijk.nl/graphql?operationName=programs",
                                    "https://graph.kijk.nl/graphql?query=query%7Bprograms%28tvSeasonId"],
                                   name="GraphQL season video listing parsing", json=True,
                                   parser=["data", "programs", "items"],
                                   creator=self.create_api_typed_item)

            self._add_data_parser("https://graph.kijk.nl/graphql?query=query%7Bsearch",
                                  name="GraphQL search", json=True,
                                  parser=["data", "search", "items"], creator=self.create_api_typed_item)

            self._add_data_parser("https://graph.kijk.nl/graphql-video",
                                  updater=self.update_graphql_item)

        # setup the main parsing data
        self._add_data_parser("https://api.kijk.nl/v1/default/sections/programs-abc",
                              name="Mainlist Json", json=True,
                              preprocessor=self.add_others,
                              parser=["items", ], creator=self.create_json_episode_item)

        self._add_data_parser("https://www.kijk.nl/programmas", match_type=ParserData.MatchExact,
                              name="Mainlist from HTML", json=True,
                              preprocessor=self.extract_main_list_json)

        self._add_data_parser("https://api.kijk.nl/v2/templates/page/format/",
                              name="Videos from the main show format page", json=True,
                              parser=["components", 3, "data", "items", 2, "data", "items"],
                              creator=self.create_json_season_item)

        self._add_data_parser("#lastweek",
                              name="Last week listing", json=True,
                              preprocessor=self.list_dates)

        self._add_data_parsers(["https://api.kijk.nl/v2/templates/page/missed/all/",
                               "https://api.kijk.nl/v1/default/sections/missed-all-"],
                               name="Day listing", json=True, preprocessor=self.extract_day_items)

        self._add_data_parser("https://api.kijk.nl/v1/default/searchresultsgrouped",
                              name="VideoItems Json", json=True,
                              parser=[], creator=self.create_json_search_item)

        self._add_data_parsers(["https://api.kijk.nl/v1/default/sections/series",
                               "https://api.kijk.nl/v1/default/seasons/"],
                               name="VideoItems Json", json=True,
                               parser=["items", ], creator=self.create_json_video_item)

        self._add_data_parser("https://api.kijk.nl/v2/default/sections/popular",
                              name="Popular items Json", json=True,
                              parser=["items", ], creator=self.create_json_popular_item)

        self._add_data_parser("https://embed.kijk.nl/",
                              updater=self.update_json_video_item)

        #===============================================================================================================
        # non standard items
        self.__video_fields = \
            "{items{__typename,title,description,guid,updated,seriesTvSeasons{id}," \
            "imageMedia{url,label},type,sources{type,drm,file},series{title}," \
            "seasonNumber,tvSeasonEpisodeNumber,lastPubDate,duration,displayGenre}}"
        
        #===============================================================================================================
        # Test cases:
        #  Piets Weer: no clips
        #  Achter gesloten deuren: seizoenen
        #  Wegmisbruikers: episodes and clips and both pages
        #  Utopia: no clips
        #  Grand Designs has almost all encrypted/non-encrypted/brigthcove streams

        # ====================================== Actual channel setup STOPS here =======================================
        UriHandler.set_cookie(name="OPTOUTMULTI", value="0:0%7Cc5:0%7Cc1:0%7Cc4:0%7Cc3:0%7Cc2:0", domain=".kijk.nl")
        return