<commit_before>const http = require('http')
    decoder = require('./m3u8decoder'),
    fs = require('fs'),
    downloader= require('./tsdownloader'),
    merger=require('./tsmerger'),
    readline = require('readline')
    
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  })
  
  rl.question('请输入视频的地址:', (answer) => {
    answer=answer.split('/')
    answer.pop()
    const baseurl = answer.join('/')
    const url = baseurl + '/index.m3u8'
    http.get(url, (res) => {
        const {statusCode} = res
        const contentType = res.headers['content-type']
        let error
        if (statusCode !== 200) {
            error = new Error('Request Failed.\n' + `Status Code: ${statusCode}`);
        } 
        if (error) {
            errHandler(error)
            // 释放内存
            res.resume()
            return
        }
        res.setEncoding('utf8')
        let rawData = ''
        res.on('data', (chunk) => {
            rawData += chunk;
        })
        res.on('end', () => {        
            try {
                fs.writeFile('r.m3u8',rawData,async err=>{
                    try{
                        const list =await decoder()
                        console.log('下载中')
                        await downloader(baseurl,list)
                        console.log('合并中')
                        await merger(list)
                    }
                    catch (e){<commit_msg>处理链接是https的情况<commit_after>const http = require('http')
    decoder = require('./m3u8decoder'),
    fs = require('fs'),
    downloader= require('./tsdownloader'),
    merger=require('./tsmerger'),
    readline = require('readline')
    
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  })
  
  rl.question('请输入视频的地址:', (answer) => {
    if(!answer.indexOf('https')==0){
        answer=answer.replace('https','http')
    }
    answer=answer.split('/')
    answer.pop()
    const baseurl = answer.join('/')
    const url = baseurl + '/index.m3u8'
    http.get(url, (res) => {
        const {statusCode} = res
        const contentType = res.headers['content-type']
        let error
        if (statusCode !== 200) {
            error = new Error('Request Failed.\n' + `Status Code: ${statusCode}`);
        } 
        if (error) {
            errHandler(error)
            // 释放内存
            res.resume()
            return
        }
        res.setEncoding('utf8')
        let rawData = ''
        res.on('data', (chunk) => {
            rawData += chunk;
        })
        res.on('end', () => {        
            try {
                fs.writeFile('r.m3u8',rawData,async err=>{
                    try{
                        const list =await decoder()
                        console.log('下载中')
                        await downloader(baseurl,list)
                        console.log('合并中')
                        // await merger(list)
                    }
                    catch (e){
{'fraction_non_alphanumeric': 0.14529058116232466, 'fraction_numerical': 0.0070140280561122245, 'mean_word_length': 1.4854771784232366, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '269621', 'n_tokens_mistral': 894, 'n_tokens_neox': 880, 'n_words': 161}