Пример #1
0
from models import UserComplete, db
#from jabber_register_user import register_user
# from myfunctions import get_data
# from dateutil import parser
# import time
# from get_image_size import getsizes
from parse_fbdata import parse_education, parse_work
from myfunctions import fb_call
import time

access_token = ['CAACEdEose0cBAPxcMpeGmuFBYeLW6ErdHEGZAVjD5rooHZCFUBvX6EQV20f1cqrZCGoVrI3GEEO8sz1yrt4RaeWua4UesUAoUQmEpfrH8DkkWcLrkMkqUeT1KBr0lnoXC1tO47RFYOKa5XSz5iOJ3njZCGH9I0pK55YLNxYXZCo1fXzJlZBA6EPOC9jI5W7ZB4ZD']

users = UserComplete.query.all()

for user in users:
	time.sleep(1)
	print user.id, user.fb_uid, user.name

	uid = user.fb_uid	

	me = fb_call(uid + '/?fields=name,picture,gender,work,education,birthday,interested_in,email,relationship_status,username', args={'access_token': access_token})
	education, education_index = parse_education(me.get('education'))
	work, work_index = parse_work(me.get('work'))
	
	# print user.education, user.work
	# print education, '\n\n', work, '\n\n'
	user.education1 = education
	user.work1 = work
	
	db.session.add(user)
	db.session.commit()
Пример #2
0
# from get_image_size import getsizes
from parse_fbdata import parse_videos, parse_likes
from myfunctions import fb_call, fql
import time

access_token = ['CAACEdEose0cBAAnhlMBhph40l5fbHzozgVcSffddKra9oaUZB1Git5ZCNJT7OFBQnwHMkAoD8Or1d62FwPnsA7WxmaHeD0TbKsMQQheJBzW29xpMKT8xZC6bXdYmP63mqe3PRzOiknnUZB0Q6ZBhZBRNZBWs4bqZAXUZD']

users = UserComplete.query.all()

for user in users:
	time.sleep(1)
	print user.id, user.fb_uid, user.name

	uid = user.fb_uid	

	vw = fb_call(uid + '/video.watches/?fields=data',args={'access_token': access_token})
	vw, vw_ids = parse_videos(vw)

	vww = fb_call(uid + '/video.wants_to_watch/?fields=data',args={'access_token': access_token})
	vww, vww_ids = parse_videos(vww)

	br = fb_call(uid + '/books.reads/?fields=data',args={'access_token': access_token})
	br, br_ids = parse_videos(br)

	bwr = fb_call(uid + '/books.wants_to_read/?fields=data',args={'access_token': access_token})
	bwr, bwr_ids = parse_videos(bwr)

	likes = fql(
	"select type, page_id, name from page where page_id in (select page_id from page_fan where uid=" + uid + ") limit 1000",
	access_token
	)
Пример #3
0
from datetime import datetime as dt
from models import User, ProfileData as pd, db
from jabber_register_user import register_user
from myfunctions import fb_call, push_to_index, get_user
from dateutil import parser
import time


access_token = ['CAACEdEose0cBAKVIiJgCYWZAihs2kewqHWSeVZCePSvKepFgIQsM4G02Ob1QIy5KngvQ6sXjMdZAZAEPlwZATlSjNf7EFP3cE0BGzAzysFTaPZC1rvzaxJguRTZAYGZA8qp3nsNWTALUXjTEo0hAWVbFAProeVRxKh8ZD']

friends = fb_call('me/friends?fields=name,picture,gender', args={'access_token': access_token})

count = 0
for friend in friends['data'][1:]:

    count += 1
    time.sleep(2)
    print count

    id = friend['id']
    name = friend['name']
    gender = friend['gender']
    url = friend['picture']['data']['url'].replace('q.jpg', 'n.jpg')
    email = id + '@fbpeople.com'

    user = User(name=name, email=email, fb_uid=id)
    db.session.add(user)
    db.session.commit()