mirror of
https://github.com/bellingcat/snscrape.git
synced 2026-06-12 20:38:29 +03:00
Convert t.co card URLs to unshortened when possible
This commit is contained in:
@@ -600,6 +600,14 @@ class _TwitterAPIScraper(snscrape.base.Scraper):
|
|||||||
kwargs['cashtags'] = [o['text'] for o in tweet['entities']['symbols']]
|
kwargs['cashtags'] = [o['text'] for o in tweet['entities']['symbols']]
|
||||||
if card:
|
if card:
|
||||||
kwargs['card'] = card
|
kwargs['card'] = card
|
||||||
|
# Try to convert the URL to the non-shortened/t.co one
|
||||||
|
try:
|
||||||
|
i = kwargs['tcooutlinks'].index(card.url)
|
||||||
|
except ValueError:
|
||||||
|
_logger.warning('Could not find card URL in tcooutlinks')
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
card.url = kwargs['outlinks'][i]
|
||||||
return Tweet(**kwargs)
|
return Tweet(**kwargs)
|
||||||
|
|
||||||
def _make_card(self, card, apiType):
|
def _make_card(self, card, apiType):
|
||||||
|
|||||||
Reference in New Issue
Block a user