Пример #1
0
 def __init__(self, thread, board="q", verbose=False, debug=False):
     self.thread = fourch.board(board).thread(thread)
     self.verbose = verbose
     self.debug = debug
     self.boss = None
     self._post_dead = False
     self._fresh = True
     self._fetch()
     self.heroes = {}
     self.events = []
Пример #2
0
def main():
    # Display usage and help if they've mucked up.
    if len(sys.argv) is not 3:
        print "usage: python {0} <board> <thread>".format(sys.argv[0])
        return
	
    str = " "	
    b = fourch.board(sys.argv[1])
    t = b.thread(sys.argv[2])
    for i in t.replies:
        str = str + i.comment_text.encode(sys.getdefaultencoding(), 'replace')
	print i.comment_text.encode(sys.getdefaultencoding(), 'replace')	
	with open('data20.txt', 'w') as myFile:
		myFile.write(str)
Пример #3
0
def main():
    if len(sys.argv) is not 3:
        print "usage: python {0} <board> <page>".format(sys.argv[0])
        return

    
    #unicodeData.encode('ascii', 'ignore')
    #sys.stdout.encoding='utf-8'
    data = " "
    thread_url = []
    thread_op = []
    page_number=int(sys.argv[2])
    str = " "
    b = fourch.board(sys.argv[1])
    #view = b.page(0)
	
    for page_number in range (0, 10):
	thr = b.page(page_number)
    	for t in thr:
	    print page_number
	    print t.op.now.encode('utf-8')
	    print t.op.url.encode('utf-8')
            print t.op.comment_text.encode(sys.getdefaultencoding(), 'replace')
	    print "\n"
	    print "-------------------------------------"
	    str = str + t.op.now.encode('utf-8') + "\n" + t.op.url.encode('utf-8') + "\n" + t.op.comment_text.encode('utf-8')  + "\n"
            thread_url.append(t.op.url.encode('utf-8'))
            thread_op.append(t.op.comment_text.encode('utf-8'))
	    with open('mymy.txt', 'w') as myFile:
	      	    myFile.write(str)
	page_number = page_number + 1

    with open('mymy.json', 'w') as outfile:
		json.dump(str, outfile)
		
    c = csv.writer(open("MYFILE.csv", "wb"))
    c.writerow(["Thread URL","Thread OP"])
    for row in zip(thread_url, thread_op):
    		c.writerow(row)