From 966a6ebd8eab3b6b7f435544e7f92dd385cb3859 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Tue, 11 Aug 2020 20:28:35 +0000 Subject: [PATCH] Skip promoted tweets/ads Fixes #67 --- snscrape/modules/twitter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snscrape/modules/twitter.py b/snscrape/modules/twitter.py index 0ed99bf..795c841 100644 --- a/snscrape/modules/twitter.py +++ b/snscrape/modules/twitter.py @@ -188,6 +188,8 @@ class TwitterSearchScraper(TwitterCommonScraper): for entry in entries: if entry['entryId'].startswith('sq-I-t-'): if 'tweet' in entry['content']['item']['content']: + if 'promotedMetadata' in entry['content']['item']['content']['tweet']: # Promoted tweet aka ads + continue tweet = obj['globalObjects']['tweets'][entry['content']['item']['content']['tweet']['id']] elif 'tombstone' in entry['content']['item']['content'] and 'tweet' in entry['content']['item']['content']['tombstone']: tweet = obj['globalObjects']['tweets'][entry['content']['item']['content']['tombstone']['tweet']['id']]