예제 #1
0
def main():
    # CHANNEL_ID = 'UCKSVUHI9rbbkXhvAXK-2uxA'
    CHANNEL_ID = 'UCzu_R-RlEXmHUIbfb0GeJDA'  # peko
    WORD = 'ペコ'
    LIMIT = 20

    inputs = {
        'channel_id': CHANNEL_ID,
        'search_word': WORD,
        'limit': LIMIT,
        'cleanup': True,
    }

    short_opts = 'hc:s:l:'
    long_opts = 'help channel_id= search_word= limit= cleanup= fast= log='.split(
    )

    try:
        opts, args = getopt.getopt(sys.argv[1:], short_opts, long_opts)
    except getopt.GetoptError:
        print_usage()
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print_usage()
            sys.exit(0)
        elif opt in ('-c', '--channel_id'):
            inputs['channel_id'] = arg
        elif opt in ('-s', '--search_word'):
            inputs['search_word'] = arg
        elif opt in ('-l', '--limit'):
            inputs['limit'] = int(arg)
        elif opt in ('--cleanup'):
            inputs['cleanup'] = bool(arg)

    print('CHANNEL_ID is ', inputs['channel_id'])
    print('WORD is ', inputs['search_word'])
    print('LIMIT is ', inputs['limit'])
    print('cleanup is ', inputs['cleanup'])

    if not CHANNEL_ID or not WORD:
        print_usage()
        sys.exit(2)

    steps = [
        Preflight(),
        GetVideoList(),
        InitializeYt(),
        DowloadCaptions(),
        ReadCaption(),
        Search(),
        DownladeVideos(),
        EditVideo(),
        Postflight()
    ]

    utils = Utils()
    p = Pipeline(steps)
    p.run(inputs, utils)
예제 #2
0
파일: main.py 프로젝트: eki66/yt-concate
def main():
    inputs = {
        'channel_id': CHANNEL_ID
    }

    steps = [
        Preflight(),
        GetVideoList(),
        DownloadCaptions(),
        ReadCaption(),
        Postflight(),
    ]

    utils = Utils()
    p = Pipeline(steps)
    p.run(inputs, utils)
예제 #3
0
def main():
    inputs = {
        'channel_id': CHANNEL_ID,
        'search_word': 'incredible',
        'limit': 20,
    }
    steps = [
        Preflight(),
        GetVideoList(),
        InitalizeYT(),
        DownloadCaptions(),
        ReadCaption(),
        Search(),
        EditVideo(),
        Postflight(),
    ]

    utils = Utils()
    p = Pipeline(steps)
    p.run(inputs, utils)
예제 #4
0
def main():
    inputs = {
        'channel_id': CHANNEL_ID,
        'search_word': 'blender',
    }

    steps = [
        Preflight(),
        GetVideoList(),
        InitializeYT(),
        DownloadCaptions(),
        ReadCaption(),
        Search(),
        DownloadVideos(),
        Postflight(),
    ]

    utils = Utils()
    p = Pipeline(steps)
    p.run(inputs, utils)
예제 #5
0
def main():
    inputs = {
        "channel_id": CHANNEL_ID,
        "search_word": "incredible",
    }

    steps = [
        Preflight(),
        GetVideoList(),
        InitializeYT(),
        DownloadCaptions(),
        ReadCaption(),
        Search(),
        DownloadVideos(),
        Postflight(),
    ]

    utils = Utils()
    p = Pipeline(steps)
    p.run(inputs, utils)
예제 #6
0
def main():
    CHANNEL_ID = 'UCKSVUHI9rbbkXhvAXK-2uxA'  # 頻道 id
    WORD = 'incredible'  # 要搜尋的字/詞
    LIMIT = 4  # 合併影片的最高片段數量
    loglevel = logging.WARNING

    inputs = {
        'channel_id': CHANNEL_ID,
        'search_word': WORD,
        'limit': LIMIT,
        'cleanup': False,  # 結果檔產生後,刪除程式執行中產生的檔案,如下載的影片/字幕等
        'fast': True,  # 跳過重複下載
        'loglevel': loglevel
    }

    short_opts = 'hc:s:l:'
    long_opts = 'help channel_id= search_word= limit= cleanup= fast= log='.split(
    )

    try:
        opts, args = getopt.getopt(
            sys.argv[1:], short_opts,
            long_opts)  # 用 opts 解析 argv 所投入的參數 ,投遞只能印出檔名後的東西
    except getopt.GetoptError:
        print_usage()
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print_usage()
            sys.exit(0)
        elif opt in ('-c', '--channel_id'):
            inputs['channel_id'] = arg
        elif opt in ('-s', '--search_word'):
            inputs['search_word'] = arg
        elif opt in ('-l', '--limit'):
            inputs['limit'] = int(arg)
        elif opt in ('--cleanup'):
            inputs['cleanup'] = bool(arg)
        elif opt in ('--fast'):
            inputs['fast'] = bool(arg)
        elif opt in ('--log'):
            inputs['loglevel'] = eval(f'logging.{arg}')

    print('CHANNEL_ID is ', inputs['channel_id'])
    print('WORD is ', inputs['search_word'])
    print('LIMIT is ', inputs['limit'])
    print('cleanup is ', inputs['cleanup'])
    print('fast is ', inputs['fast'])
    print('log level is ', inputs['loglevel'])

    if not CHANNEL_ID or not WORD:
        print_usage()
        sys.exit(2)

    steps = [
        Preflight(),
        GetVideoList(),
        InitializeYT(),
        DownloadCaptions(),
        ReadCaption(),
        Search(),
        DownloadVideos(),
        EditVideo(),
        Postflight(),
    ]

    config_logger(inputs['loglevel'])
    utils = Utils()
    p = Pipeline(steps)
    p.run(inputs, utils)