# Path: lib/_db.py
# def get_collection(db_name, collection_name, client='mongo'):
#     client = client_db_map.get(client)
#     db = getattr(client, db_name, None)
#     return getattr(db, collection_name, None)


import _env
import json
import re
import time
    import sys
from html2text import html2text
from extract import extract
from lib._db import get_collection
from config.config import CONFIG
from judge_upload import exist_or_insert
        "created_at":   1283780649000,
        "created_by":   1,
        "updated_at":   1286958624000,
        "updated_by":   1
    }
]


TAGS = [
    {
        "id": 5000,
        "name": u"放松一下",
        "slug": u"funny",
        "description": ""
    }
]
TAG_ID_MAP = {}


def gen_tag_id():
    tag_li = FUNNY_ID.split('\n')
    for i in tag_li:
        tag = i.split()[0]
        tag_id = int(i.split()[-1])
        TAG_ID_MAP[tag] = tag_id

    for tag, tag_id in TAG_ID_MAP.items():
        TAGS.append(
            {
                "id": tag_id,

# Path: lib/_db.py
# def get_collection(db_name, collection_name, client='mongo'):
#     client = client_db_map.get(client)
#     db = getattr(client, db_name, None)
#     return getattr(db, collection_name, None)


# Path: crawler/xianguo/funny_to_ghost.py
import _env
import json
import re
import time
    import sys
from html2text import html2text
from extract import extract
from lib._db import get_collection
from config.config import CONFIG
from judge_upload import exist_or_insert

        "created_at":   1283780649000,
        "created_by":   1,
        "updated_at":   1286958624000,
        "updated_by":   1
    }
]


TAGS = [
    {
        "id": 5000,
        "name": u"放松一下",
        "slug": u"funny",
        "description": ""
    }
]
TAG_ID_MAP = {}


def gen_tag_id():
    tag_li = FUNNY_ID.split('\n')
    for i in tag_li:
        tag = i.split()[0]
        tag_id = int(i.split()[-1])
        TAG_ID_MAP[tag] = tag_id

    for tag, tag_id in TAG_ID_MAP.items():
        TAGS.append(
            {
                "id": tag_id,

                "name": tag,