script/lib/iri_tweet/export_twitter_alchemy.py
changeset 379 083320a74eb2
parent 289 a5eff8f2b81d
child 411 0471e6eb8a1b
equal deleted inserted replaced
378:c17ae1e12a46 379:083320a74eb2
   280                         ts = tweet_ts
   280                         ts = tweet_ts
   281                     tweet_ts_rel = (tweet_ts-ts) * 1000
   281                     tweet_ts_rel = (tweet_ts-ts) * 1000
   282                     username = None
   282                     username = None
   283                     profile_url = ""
   283                     profile_url = ""
   284                     if tw.user is not None:
   284                     if tw.user is not None:
   285                         username = tw.user.name
   285                         username = tw.user.name                    
   286                         profile_url = tw.user.profile_image_url
   286                         profile_url = tw.user.profile_image_url if tw.user.profile_image_url is not None else ""
   287                     if not username:
   287                     if not username:
   288                         username = "anon."
   288                         username = "anon."
   289                     
   289                     
   290                     element = etree.SubElement(elements, u"element" , {u"id":unicode(uuid.uuid4())+u"-"+unicode(tw.id), u"color":unicode(options.color), u"author":unicode(username), u"date":unicode(tweet_ts_dt.strftime("%Y/%m/%d")), u"begin": unicode(tweet_ts_rel), u"dur":u"0", u"src":unicode(profile_url)})
   290                     element = etree.SubElement(elements, u"element" , {u"id":unicode(uuid.uuid4())+u"-"+unicode(tw.id), u"color":unicode(options.color), u"author":unicode(username), u"date":unicode(tweet_ts_dt.strftime("%Y/%m/%d")), u"begin": unicode(tweet_ts_rel), u"dur":u"0", u"src":unicode(profile_url)})
   291                     etree.SubElement(element, u"title").text = unicode(username) + u": " + unicode(tw.text)
   291                     etree.SubElement(element, u"title").text = unicode(username) + u": " + unicode(tw.text)