def main(args=None):
    parser = argparse.ArgumentParser(description='Conversation Scraper')
    parser.add_argument('--id', metavar='conversationID', dest='convID', required=True)
    parser.add_argument('--size', metavar='chunkSize', type=int, dest='chunkSize', default=2000, help='number of messages to retrieve for each request')
    parser.add_argument('--off', metavar='offset', type=int, dest='offset', default=0, help='messages number scraping offset')
    parser.add_argument('--date', metavar='offset', type=int, dest='timestampOffset', default=0, help='messages timestamp scraping offset, has precedence over messages number offset')
    parser.add_argument('--limit', type=int, dest='limit', default=0, help='number of messages to be retrieved')
    parser.add_argument('-m', dest='merge', action='store_true', help='merge the new messages with previously scraped conversation')
    parser.add_argument('-g', dest='isGroupConversation', action='store_true', help='specify if you want to scrape a group conversation')
    parser.set_defaults(merge=False)
    baseFolderPath = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
    parser.add_argument('--out', metavar='outputDir', dest='outDir', default=os.path.join(baseFolderPath, 'Messages'))
    parser.add_argument('--conf', metavar='configFilepath', dest='configFilepath', default=os.path.join(baseFolderPath, 'config.ini'))
    args = parser.parse_args()
    convID = args.convID
    chunkSize = args.chunkSize
    timestampOffset = args.timestampOffset
    offset = args.offset
    limit = args.limit
    merge = args.merge
    isGroupConversation = args.isGroupConversation
    outDir = args.outDir
    configFilepath = args.configFilepath
    DATA_SECTION = 'User Data'
    config = configparser.ConfigParser(interpolation=None)
    config.read(configFilepath)
    cookie = config.get(DATA_SECTION, 'Cookie')
    fb_dtsg = config.get(DATA_SECTION, 'Fb_dtsg')
    scraper = ConversationScraper(convID, cookie, fb_dtsg, outDir)
    scraper.scrapeConversation(merge, offset, timestampOffset, chunkSize, limit, isGroupConversation)
def main(args=None):
    parser = argparse.ArgumentParser(description='Conversation Scraper')
    parser.add_argument('--id', metavar='conversationID', dest='convID', required=True)
    parser.add_argument('--size', metavar='chunkSize', type=int, dest='chunkSize', default=2000, help='number of messages to retrieve for each request')
    parser.add_argument('--off', metavar='offset', type=int, dest='offset', default=0, help='messages number scraping offset')
    parser.add_argument('--date', metavar='offset', type=int, dest='timestampOffset', default=0, help='messages timestamp scraping offset, has precedence over messages number offset')
    parser.add_argument('--limit', type=int, dest='limit', default=0, help='number of messages to be retrieved')
    parser.add_argument('-m', dest='merge', action='store_true', help='merge the new messages with previously scraped conversation')
    parser.add_argument('-g', dest='isGroupConversation', action='store_true', help='specify if you want to scrape a group conversation')
    parser.set_defaults(merge=False)
    baseFolderPath = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
    parser.add_argument('--out', metavar='outputDir', dest='outDir', default=os.path.join(baseFolderPath, 'Messages'))
    parser.add_argument('--conf', metavar='configFilepath', dest='configFilepath', default=os.path.join(baseFolderPath, 'config.ini'))
    args = parser.parse_args()
    convID = args.convID
    chunkSize = args.chunkSize
    timestampOffset = args.timestampOffset
    offset = args.offset
    limit = args.limit
    merge = args.merge
    isGroupConversation = args.isGroupConversation
    outDir = args.outDir
    configFilepath = args.configFilepath
    DATA_SECTION = 'User Data'
    config = configparser.ConfigParser(interpolation=None)
    config.read(configFilepath)
    cookie = config.get(DATA_SECTION, 'Cookie')
    fb_dtsg = config.get(DATA_SECTION, 'Fb_dtsg')
    scraper = ConversationScraper(convID, cookie, fb_dtsg, outDir)
    scraper.scrapeConversation(merge, offset, timestampOffset, chunkSize, limit, isGroupConversation)