# 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 judge_upload import exist_or_insert
from config.config import CONFIG
#!/usr/bin/env python
# -*- coding:utf-8 -*-

DB = CONFIG.MONGO.DATABASE


def is_python_article(data_dict):
    title = data_dict.get('title').lower()
    content = data_dict.get('content').lower()
    if ('python' in title) or (content.count('python') > 2):
        return True
    return False



# 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/python_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 judge_upload import exist_or_insert
from config.config import CONFIG

#!/usr/bin/env python
# -*- coding:utf-8 -*-

DB = CONFIG.MONGO.DATABASE


def is_python_article(data_dict):
    title = data_dict.get('title').lower()
    content = data_dict.get('content').lower()
    if ('python' in title) or (content.count('python') > 2):
        return True
    return False



def get_first_img(html):