Example #1
0
    def process(self, data, inputs, utils):
        search_word = inputs['search_word']

        found = []
        for yt in data:
            captions = yt.captions
            if not captions:
                continue

            for caption in captions:
                if search_word in caption:
                    time = captions[caption]
                    found.append(Found(yt, caption, time))
        return found
Example #2
0
 def process(self, data, inputs, utils, logger):
     search_word = inputs['search_word']
     found = []  # 找到的list
     for yt in data:
         captions = yt.captions
         if not captions:  # 如有不存在的字幕檔  則略過~
             continue
         for caption in captions:
             if search_word in caption:
                 time = captions[caption]
                 f = Found(yt, caption, time)
                 found.append(f)
     # print(found)
     return found
Example #3
0
    def process(self, data, inputs, utils, logger):
        search_word = inputs['search_word']

        found = []
        for yt in data:
            captions = yt.captions
            if not captions:
                continue
            for caption in captions:
                if search_word in caption:
                    time = captions[caption]
                    f = Found(yt, caption, time)
                    found.append(f)
        logger.info('找到' + str(len(found)) + '部影片符合搜尋字串:' + search_word)
        return found
Example #4
0
    def process(self, data, inputs, utils):
        search_word = inputs['search_word']

        found = []
        for yt in data:
            captions = yt.captions
            if not captions:
                continue

            for caption in captions:
                if search_word in caption:
                    time = captions[caption]
                    f = Found(f)

        print(len(found))
        return found
Example #5
0
    def process(self, data, inputs, utils, logger):
        search_word = inputs['search_word']

        found = []
        for yt in data:
            captions = yt.captions
            if not captions:
                continue

            for caption in captions:
                if search_word in caption:
                    time = captions[caption]
                    f = Found(yt, caption, time)
                    found.append(f)
                    # Found是新的物件 裡面會有yt, caption, time
        # print(f'searching files: {len(found)}')
        logger.info(f'searching files: {len(found)}')
        return found
Example #6
0
    def process(self, data, inputs, utils):
        search_term = inputs['search_term']

        found = []
        for yt in data:
            captions = yt.captions
            if not captions:
                continue

            for caption in captions:
                if search_term in caption:
                    time = captions[caption]
                    f = Found(yt, caption, time)
                    found.append(f)

        print('found', len(found), '"', inputs['search_term'],
              '" in all the captions we have.')
        return found
Example #7
0
    def process(self, data, inputs, utils):
        logger = logging.getLogger(f'mainModule.{__name__}')
        search_word = inputs['search_word']

        found = []
        for yt in data:
            captions = yt.captions
            if not captions:
                continue

            for caption in captions:
                if search_word in caption:
                    time = captions[caption]
                    f = Found(yt, caption, time)
                    found.append(f)

        logger.info(found)
        return found
Example #8
0
    def process(self, data, inputs, utils):
        logging = config_logger()
        search_word = inputs['search_word']

        found = []
        for yt in data:
            captions = yt.captions
            if not captions:
                continue

            for caption in captions:
                if search_word in caption:
                    time = captions[caption]
                    f = Found(yt, caption, time)
                    found.append(f)

        logging.info("{} of videos found for this searchword".format(
            len(found)))
        return found
Example #9
0
    def process(self, data, inputs, utils):
        search_word = inputs['search_word']

        found = []
        for yt in data:
            captions = yt.captions  # 是一個字典,key為字幕、value為時間
            if not captions:  # 如果沒有這個物件,跳下一回(因為有些沒有下載到字幕檔,使用forloop迴圈時會當掉)
                continue

            for caption in captions:
                if search_word in caption:
                    time = captions[caption]  # 存下時間
                    f = Found(yt, caption, time)  # 作成一個Found實例
                    found.append(f)
                    print(f'found {search_word} in', repr(f))

        print(len(found))
        print(found)
        return found
Example #10
0
    def process(self, data, inputs, utils):
        logger = logging.getLogger(__name__)
        logger.info("in Search")
        search_word = inputs['search_word']
        qq = False
        found = []
        for yt in data:
            captions = yt.captions
            if not captions:
                continue
            for caption in captions:
                if search_word in caption:
                    time = captions[caption]
                    f = Found(yt, caption, time)
                    found.append(f)

        logger.info(
            f"found {inputs['search_word']} at all videos has {len(found)} times"
        )
        return found