Git Product home page Git Product logo

Comments (7)

kensanata avatar kensanata commented on September 16, 2024 1

Yeah, or a more generic --newer-than N.

from mastodon-archive.

kensanata avatar kensanata commented on September 16, 2024

from mastodon-archive.

BartG95 avatar BartG95 commented on September 16, 2024

Maybe a simple —more option would be a good solution?

Agreed.

Or perhaps we could add an option saying that we actually only care about the hashtags we recently used (half a year?).

That would be a nice extra. Something like --report-recent-weeks N?

from mastodon-archive.

kensanata avatar kensanata commented on September 16, 2024

Solved in 3e8afb6.

from mastodon-archive.

BartG95 avatar BartG95 commented on September 16, 2024

Hmm, not enterily solved: there isn't yet an option to include boosts in the tags. Feel free to apply the diff below (already tested):

diff --git a/mastodon_archive/__init__.py b/mastodon_archive/__init__.py
index 476e1f5..781dec5 100644
--- a/mastodon_archive/__init__.py
+++ b/mastodon_archive/__init__.py
@@ -106,9 +106,6 @@ if and only if they are in your archive''')
     parser_content.add_argument("--top", dest='top',
                                 metavar='N', type=int, default=10,
                                 help='only print the top N tags')
-    parser_content.add_argument("--include-boosts", dest='include_boosts', action='store_const',
-                                const=True, default=False,
-                                help='include boosts')
     parser_content.add_argument("user",
                                 help='your account, e.g. [email protected]')
     parser_content.set_defaults(command=report.report)
diff --git a/mastodon_archive/report.py b/mastodon_archive/report.py
index e29f51b..990f2c5 100644
--- a/mastodon_archive/report.py
+++ b/mastodon_archive/report.py
@@ -39,14 +39,12 @@ def media(statuses):
     return i
 
 
-def tags(statuses, include_boosts):
+def tags(statuses):
     """
     Count all the hashtags in statuses
     """
     count = {}
     for item in statuses:
-        if include_boosts and item["reblog"] is not None:
-            item = item["reblog"]
         for name in [tag["name"] for tag in item["tags"]]:
             if name in count:
                 count[name] += 1
@@ -54,7 +52,7 @@ def tags(statuses, include_boosts):
                 count[name] = 1
     return count
 
-def print_tags(statuses, max, include_boosts):
+def print_tags(statuses, max):
     """
     Print hashtags used in statuses
     """
@@ -62,7 +60,7 @@ def print_tags(statuses, max, include_boosts):
         print("All the hashtags:")
     else:
         print("Top " + str(max) + " hashtags:")
-    count = tags(statuses, include_boosts)
+    count = tags(statuses)
     most = sorted(count.keys(), key = lambda tag: -count[tag])
     print(textwrap.fill(" ".join(
         ["#"+tag+"("+str(count[tag])+")" for tag in most[0:max]])))
@@ -108,7 +106,7 @@ def report(args):
         print("Media:".ljust(20), str(media(statuses)).rjust(6))
 
         print()
-        print_tags(statuses, args.top, args.include_boosts)
+        print_tags(statuses, args.top)
 
     if "statuses" in data and "favourites" in data:
         print()
@@ -119,4 +117,4 @@ def report(args):
         print("Media:".ljust(20), str(media(favourites)).rjust(6))
 
         print()
-        print_tags(favourites, args.top, args.include_boosts)
+        print_tags(favourites, args.top)

from mastodon-archive.

kensanata avatar kensanata commented on September 16, 2024

Do you want to do this via a pull request? That way, author and all will be correct without me having to fiddle with the command line too much.

from mastodon-archive.

BartG95 avatar BartG95 commented on September 16, 2024

Done by #26

from mastodon-archive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.