from instaloader import Instaloader, Profile import traceback import copy import operator import dataset import pandas as pd import networkx as nx #import pysftp import codecs import pyvis import sys import pickle import os import searchconsole from pyvis.network import Network import jieba import sys import codecs import traceback import requests import re import pandas as pd import random import urllib import dataset import json import gspread import datetime from gspread_pandas import Spread, Client from oauth2client.service_account import ServiceAccountCredentials import os import threading def save_sheet(df,filename,tabname,startpos='A1'): scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive'] credentials = ServiceAccountCredentials.from_json_keyfile_name('c:\\keys\\spread2.json', scope) # credentials = ServiceAccountCredentials.from_json_keyfile_name('/var/keys/spread2.json', scope) gc = gspread.authorize(credentials) spread = Spread(filename,creds=credentials) spread.df_to_sheet(df, index=False, sheet=tabname, start=startpos, replace=False) db = dataset.connect('sqlite:///:memory:') table=db['tmp'] #pname='cont' #pname='damanwoo' #pname='drama' pname='news' #pname='www' #pname='ipromise' #pname='sports' #pname='rumor' #pname='korea' def get_css(): return '' # fr=codecs.open('jared/data/css.txt','r','utf-8') # lines=fr.readlines() # content=' '.join(lines) # fr.close() # return content def modify_file(fname): fr=codecs.open(fname,'r','utf-8') lines=fr.readlines() fr.close() css=get_css() content_output='' for l in lines: if '' in l[0:10]: content_output+=l content_output+='\n
\n' continue if '