Skip to content

Commit

Permalink
Merge pull request #14 from UPB-SS1/remove_range_limit
Browse files Browse the repository at this point in the history
Remove range limit
  • Loading branch information
JoseRZapata authored May 8, 2021
2 parents 2dcb10d + c2d91b0 commit 4c7a05b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setup(
name="pycoornet",
version="0.2.3",
version="0.2.4",
description="Using Python Given a set of URLs, this packages detects coordinated link sharing behavior on social media and outputs the network of entities that performed such behaviour.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
12 changes: 8 additions & 4 deletions src/pycoornet/crowdtangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, api_key):
self.api_key = api_key

def get_shares(self, urls, url_column='url', date_column='date', platforms=('facebook', 'instagram'),
nmax=500, sleep_time=20, clean_urls=False, save_ctapi_output=False, id_column=None, remove_days=None):
nmax=1000, sleep_time=20, clean_urls=False, save_ctapi_output=False, id_column=None, remove_days=None):
""" Get the URLs shares from CrowdTangle from a list of URLs with publish datetime
Args:
Expand Down Expand Up @@ -86,7 +86,12 @@ def get_shares(self, urls, url_column='url', date_column='date', platforms=('fac
# set date limits, endDate: one week after date_published
startDate = urls.iloc[i, :].loc['date']
#startDate = startDate.replace(microsecond=0)
endDate = startDate + pd.Timedelta('7 day')
if remove_days:
days = f"{remove_days} day"
endDate = startDate + pd.Timedelta(days)
else:
endDate = None

url = urls.iloc[i, :].loc['url']
try:
# pycrowdtangle get links
Expand Down Expand Up @@ -152,8 +157,7 @@ def get_shares(self, urls, url_column='url', date_column='date', platforms=('fac
if id_column:
df_full["id_column"] = urls.iloc[i, :].loc[id_column]


# remove shares performed more than one week from first share
# remove shares performed more than x days from first share
if remove_days:
# ex: '7 day'
days = f"{remove_days} day"
Expand Down

0 comments on commit 4c7a05b

Please sign in to comment.