資源簡介
天眼查公司數(shù)據(jù)抓取 自動(dòng)登陸 跳轉(zhuǎn)抓取 翻頁 寫入數(shù)據(jù)庫

代碼片段和文件信息
import?pymysql
import?time
def?rongzi(table):
????#?時(shí)間?輪次?估值?金額?比例?投資方?新聞來源
????conn?=?pymysql.connect(host=‘localhost‘?user=‘root‘?passwd=‘root‘?db=‘luhao35‘?port=3306?charset=‘utf8‘)
????cur?=?conn.cursor()??#?獲取一個(gè)游標(biāo)
????print(table)
????for?i?in?table:
????????sql?=?“INSERT?INTO?cmf_ent_rongzi?(entident_uid?rongzi_timerongzi_luncirongzi_guzhirongzi_jinerongzi_bilirongzi_touzifangrongzi_laiyuan)?VALUES?(?‘%s‘?‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘)“
????????try:
????????????cur.execute(sql?%?i)
????????????conn.commit()
????????except:
????????????conn.rollback()
????cur.close()??#?關(guān)閉游標(biāo)
????conn.close()??#?釋放數(shù)據(jù)庫資源
def?touzi(table):
????#?時(shí)間?輪次?金額?投資方?產(chǎn)品?地區(qū)?行業(yè)?業(yè)務(wù)
????conn?=?pymysql.connect(host=‘localhost‘?user=‘root‘?passwd=‘root‘?db=‘luhao35‘?port=3306?charset=‘utf8‘)
????cur?=?conn.cursor()??#?獲取一個(gè)游標(biāo)
????print(table)
????for?i?in?table:
????????sql?=?“INSERT?INTO?cmf_ent_touzi?(entident_uid?touzi_timetouzi_luncitouzi_jinetouzi_touzifangtouzi_chanpintouzi_diqutouzi_hangyetouzi_yewu)?VALUES?(?‘%s‘?‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘)“
????????try:
????????????cur.execute(sql?%?i)
????????????conn.commit()
????????except:
????????????conn.rollback()
????cur.close()??#?關(guān)閉游標(biāo)
????conn.close()??#?釋放數(shù)據(jù)庫資源
def?branch(table):
????#?名稱?職位?公司名稱??entuid
????conn?=?pymysql.connect(host=‘localhost‘?user=‘root‘?passwd=‘root‘?db=‘luhao35‘?port=3306?charset=‘utf8‘)
????cur?=?conn.cursor()??#?獲取一個(gè)游標(biāo)
????print(table)
????for?i?in?table:
????????sql?=?“INSERT?INTO?cmf_ent_branch?(entident_uid?branch_namebranch_farenbranch_statusbranch_time)?VALUES?(?‘%s‘?‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘)“
????????try:
????????????cur.execute(sql?%?i)
????????????conn.commit()
????????except:
????????????conn.rollback()
????cur.close()??#?關(guān)閉游標(biāo)
????conn.close()??#?釋放數(shù)據(jù)庫資源
def?tminfo(table):
????#?名稱?職位?公司名稱??entuid
????conn?=?pymysql.connect(host=‘localhost‘?user=‘root‘?passwd=‘root‘?db=‘luhao35‘?port=3306?charset=‘utf8‘)
????cur?=?conn.cursor()??#?獲取一個(gè)游標(biāo)
????print(table)
????for?i?in?table:
????????sql?=?“INSERT?INTO?cmf_ent_knowledge?(entident_uid?k_timek_logok_namek_regnok_typek_liucheng)?VALUES?(?‘%s‘?‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘)“
????????try:
????????????cur.execute(sql?%?i)
????????????conn.commit()
????????except:
????????????conn.rollback()
????cur.close()??#?關(guān)閉游標(biāo)
????conn.close()??#?釋放數(shù)據(jù)庫資源
def?staff(table):
????#?名稱?職位?公司名稱??entuid
????conn?=?pymysql.connect(host=‘localhost‘?user=‘root‘?passwd=‘root‘?db=‘luhao35‘?port=3306?charset=‘utf8‘)
????cur?=?conn.cursor()??#?獲取一個(gè)游標(biāo)
????print(table)
????for?i?in?table:
????????sql?=?“INSERT?INTO?cmf_person?(ent_uid?name?roleentNameentUid)?VALUES?(?‘%s‘?‘%s‘‘%s‘‘%s‘‘%s‘)“
????????try:
????????????cur.execute(sql?%?i)
????????????conn.commit()
????????except:
????????????conn.rollback()
????cur.close()??#?關(guān)閉游標(biāo)
????conn.close()??#?釋放數(shù)據(jù)庫資源
#
def?change(table):
????#?名稱?職位?
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????13228??2018-03-14?15:06??tian.py
?????文件????????7903??2018-03-14?16:52??conn_mysql.py
評(píng)論
共有 條評(píng)論