Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion feedly/api_client/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,25 @@ def tag_entries(self, entry_ids: List[str]):
self._client.do_api_request(f'/v3/tags/{quote_plus(self["id"])}', method='put',
data={'entryIds': [entry_id for entry_id in entry_ids]})

def delete_tags(self, options: StreamOptions = None):
"""
*** WARNING *** Non-reversible operation
Given a TagBase Streamable, remove tags corresponding to this tag stream, for all articles downloaded
with options StreamOptions. If User is part of a Team, this will also delete the teammate tags that correspond
to this board
:param options: specify high max_count to empty the board.
:return:
"""
a_ids = [a["id"] for a in self.stream_contents(options)]
tag_id = self._get_id()
while len(a_ids) > 0:
batch_size = 50 # limitation due to the url length: articles are "de-tagged" by batch of 50.
to_delete = a_ids[:batch_size]
a_ids = a_ids[batch_size:]
self._client.do_api_request(
f'/v3/tags/{quote_plus(tag_id)}/{",".join([quote_plus(d) for d in to_delete])}', method='DELETE'
)


class UserCategory(Streamable):

Expand Down Expand Up @@ -310,7 +329,7 @@ def delete_tags(self, streamable: Streamable, options: StreamOptions = None):
if tagged_by_user == self['id']:
a_ids += [a["id"]]
while len(a_ids)>0:
batch_size = 10 # limitation due to the url length: articles are "de-tagged" by batch of 10.
batch_size = 50 # limitation due to the url length: articles are "de-tagged" by batch of 50.
to_delete = a_ids[:batch_size]
a_ids = a_ids[batch_size:]
self._client.do_api_request(
Expand Down