Posts

Showing posts from March 25, 2019

Why am I only able to get certain links in tweets?

Image
0 I'm making a program that takes in a Twitter username and returns all of the external links a user shared. So far the program returns some links, but not others, even among tweets linking to the same website. I've recognized that the problem is that for the tweets that do return external links as desired, the external link is the "expanded_url" attribute of the tweet. For the tweets that don't return the external link, the "expanded_url" attribute is just the link to the tweet itself. Anyone know why this is? Is there any way around this? I'm using Tweepy and the "expanded URL" attribute. For example, these two similar tweets: https://twitter.com/KamalaHarris/status/1079137488378183681 https://twitter.com/KamalaHarris/status/1077337876227084290 The first

Rio Paraopeba

Image
Esta página ou secção cita fontes confiáveis e independentes, mas que não cobrem todo o conteúdo, o que compromete a verificabilidade (desde janeiro de 2019) . Por favor, insira mais referências no texto. Material sem fontes poderá ser removido. — Encontre fontes: Google (notícias, livros e acadêmico) Rio Paraopeba Rio Paraopeba após o rompimento da barregem em Brumadinho Localização País  Brasil Coordenadas 18° 12′ 51″ S, 45° 15′ 46″ O Dimensões Comprimento 510 km Hidrografia Tipo Rio Nascente Cristiano Otoni, em Minas Gerais, no Brasil Afluente principal Águas Claras, Macaúbas, Betim, Camapuã e Manso Foz Represa de Três Marias, no município de Felixlândia, em Minas Gerais, no Brasil editar - editar código-fonte - editar Wikidata O rio Paraopeba é um rio que banha o estado de Minas Gerais, no Brasil. Em 25/01/2019, o rio foi impactado pelo Rompimento de barragem em Brumadinho, da mineradora Vale S.A. Í

Swift - check if a timestamp is yesterday, today, tomorrow, or X days ago

Image
34 16 I'm trying to work out how to decide if a given timestamp occurs today, or +1 / -1 days. Essentially, I'd like to do something like this (Pseudocode) IF days_from_today(timestamp) == -1 RETURN 'Yesterday' ELSE IF days_from_today(timestamp) == 0 RETURN 'Today' ELSE IF days_from_today(timestamp) == 1 RETURN 'Tomorrow' ELSE IF days_from_today(timestamp) < 1 RETURN days_from_today(timestamp) + ' days ago' ELSE RETURN 'In ' + days_from_today(timestamp) + ' ago' Crucially though, it needs to be in Swift and I'm struggling with the NSDate / NSCalendar objects. I started with working out the time difference like this: let calendar = NSCalendar.currentCalendar() let date = NSDate(timeIntervalSince1970: Double(timestamp)) let timeDifference = c