1 / 26

Facebook 2 Día 37, 16 abril 2014

Facebook 2 Día 37, 16 abril 2014. Tecnología de lenguaje humano en español SPAN 4350 Harry Howard Tulane University. Repaso. Prueba siguiente. Sacar los comentarios de un video de YouTube que te guste y …. Para empezar. Instalar 'facepy': $ pip install facepy

edward
Download Presentation

Facebook 2 Día 37, 16 abril 2014

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Facebook 2Día 37, 16 abril 2014 Tecnología de lenguaje humano en español SPAN 4350 Harry Howard Tulane University

  2. Repaso SPAN 4350 - Harry Howard - Tulane University

  3. Prueba siguiente • Sacar los comentarios de un video de YouTube que te guste y …. SPAN 4350 - Harry Howard - Tulane University

  4. Para empezar • Instalar 'facepy': • $ pip install facepy • Abre una sesión de Facebook. • Visita este enlace: • https://developers.facebook.com/tools/explorer • Pincha "Get Access Token" … SPAN 4350 - Harry Howard - Tulane University

  5. User Data Permissions: √ user_status SPAN 4350 - Harry Howard - Tulane University

  6. Friends Data Permissions: √ friend_status SPAN 4350 - Harry Howard - Tulane University

  7. Pincha "Get Access Token" SPAN 4350 - Harry Howard - Tulane University

  8. Facebook te pide permisoPincha "ok" SPAN 4350 - Harry Howard - Tulane University

  9. Copia el accesstoken al script SPAN 4350 - Harry Howard - Tulane University

  10. Facebook SPAN 4350 - Harry Howard - Tulane University

  11. Consultas con Graph API Explorer • Graph API • GET  /me • FQL Query • SELECT [fields] FROM [table] WHERE [conditions] • SELECT name FROM userWHERE uid = me() • https://developers.facebook.com/docs/reference/fql/ > user SPAN 4350 - Harry Howard - Tulane University

  12. Lenguaje de consulta de Facebook • Pincha 'FQL Query'. • En la caja que hay por debajo, entra "SELECT name FROM user WHERE uid = me()" y pincha "Submit": SPAN 4350 - Harry Howard - Tulane University

  13. Lenguaje de consulta de Facebook • Repetición del formato: • SELECT [fields] FROM [table] WHERE [conditions] • SELECT name FROM user WHERE uid = me() • El variable fundamental es 'table', o sea 'user' • Abre un tab nuevo y visita: • https://developers.facebook.com/docs/reference/fql/ SPAN 4350 - Harry Howard - Tulane University

  14. Pincha 'user' Vuelve a la página anterior … SPAN 4350 - Harry Howard - Tulane University

  15. Pincha 'status' SPAN 4350 - Harry Howard - Tulane University

  16. Lenguaje de consulta de Facebook • Vuelve al tab "Explorer – Facebook Developers" • Entra la consulta "SELECT message FROM status WHERE uid = me()" • y pincha "Submit". SPAN 4350 - Harry Howard - Tulane University

  17. Resultados SPAN 4350 - Harry Howard - Tulane University

  18. Lenguaje de consulta de Facebook • Ahora entra la consulta "SELECT message FROM status WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())" • y pincha "Submit". SPAN 4350 - Harry Howard - Tulane University

  19. Resultados SPAN 4350 - Harry Howard - Tulane University

  20. Lenguaje de consulta de Facebook • Ahora entra la consulta "SELECT message FROM status WHERE uid = me() OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())" • y pincha "Submit". SPAN 4350 - Harry Howard - Tulane University

  21. ResultadosParece que no hay estados míos SPAN 4350 - Harry Howard - Tulane University

  22. facebookAnon.py # -*- coding: utf-8 -*- fromfacepyimportGraphAPI # getaccesstokenfromhttps://developers.facebook.com/tools/explorer? # user data permissions: checkuser_status # friends data permissions: checkfriends_status access_token = tu_info_aqui' graph = GraphAPI(access_token) my_status_data = graph.fql('SELECT message FROM status WHERE uid = me()') my_status_dict = my_status_data['data'] my_statuses = [] for s in my_status_dict: my_statuses.append(s['message']) print 'Hay '+str(len(my_statuses))+' mensajes.' friends_status_data = graph.fql('SELECT message FROM status WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())') friends_status_dict = friends_status_data['data'] friends_statuses = [] for s in friends_status_dict: friends_statuses.append(s['message']) print 'Hay '+str(len(friends_statuses))+' mensajes.' our_status_data = graph.fql('SELECT message FROM status WHERE uid = me() OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())') our_status_dict = our_status_data['data'] our_statuses = [] for s in our_status_dict: our_statuses.append(s['message']) print 'Hay '+str(len(our_statuses))+' mensajes.' SPAN 4350 - Harry Howard - Tulane University

  23. El problema • Quiero recoger muchos estados en español, … • pero no quiero inundar mi 'perfil' con ellos. • Soluciones • Crear una perfil para ello. • Facebook no me lo permitió. • Crear la página "HLT Spanish data agent". • No puede 'recoger' información, sino publicarla. • Crear el 'interés' "Spanish data". • Parece que es una carácterística nueva que no está documentada en el API/IPA. SPAN 4350 - Harry Howard - Tulane University

  24. Tarea • Recoge algún texto en español en tu perfil y trata de sacarlo con el script de facebook. SPAN 4350 - Harry Howard - Tulane University

  25. Notas de pruebas SPAN 4350 - Harry Howard - Tulane University

  26. ¿Redes? El próximo día SPAN 4350 - Harry Howard - Tulane University

More Related